Hack Forums
data-port attribute in <span> tag - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Webmasters (https://hackforums.net/forumdisplay.php?fid=141)
+---- Forum: Website Construction (https://hackforums.net/forumdisplay.php?fid=50)
+---- Thread: data-port attribute in <span> tag (/showthread.php?tid=5574140)



data-port attribute in <span> tag - klatzen - Mar 13, 2017

Hello guys !

I'm not sure this is the right forum for my question, but here goes.

In my web scraping journey I recently found something that I have not seen before:

<td><span class="port" data-port="5652045C"></span></td>

I know a little HTML & CSS, but have never stumbled upon the data-port attribute before. The above line outputs: 3128 (yes its a port number), but I cant seem to figure out how it does it. Browsers aren't that clever that the above shouldn't be something that we can decode quite easily, but I'm stuck .. I have looked for traces of JS and such, but have not found anything..

So, do any of you guys have an idea what this sorcery is or knows what "encryption" this is?

Cheers


* - Ganja - Mar 13, 2017

the 'data-SOMEVAR' attribute is often used in combination with JS to store information. It can be anything really (data-user=, data-myData=, data-klatzen=, etc).


* - Hash G. - Mar 13, 2017

https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/data-*


* - klatzen - Mar 14, 2017

(Mar 13, 2017 05:51 PM)Yani Wrote:  Yep, I'm 99% sure it'll be javascript that decrypts it.
Post the website and we could help you.

Hey m8,

The source is: view-source:http://proxyservers.pro/proxy/list/order/updated/order_dir/desc/page

All ports is encoded that way, I have tried to briefly look over the JS, but cant find anything.. I hope that you will be more lucky :)


(Mar 13, 2017 02:26 PM)♔ Royal Wrote:  the 'data-SOMEVAR' attribute is often used in combination with JS to store information. It can be anything really (data-user=, data-myData=, data-klatzen=, etc).

Thank you! Thats why I couldnt find anything on google since I searched for "Data-port" :)


* - klatzen - Mar 14, 2017

(Mar 14, 2017 08:06 AM)Yani Wrote:  This is the javascript function that gets ran over the port data:

Code
function decode(e, t) {
    for (var n = [], i = 0, r = 0; i < e.length - 1; i += 2, r++) n[r] = parseInt(e.substr(i, 2), 16);
    for (var a = [], i = 0; i < t.length; i++) a[i] = t.charCodeAt(i);
    for (var i = 0; i < n.length; i++) n[i] = n[i] ^ a[i % a.length];
    for (var i = 0; i < n.length; i++) n[i] = String.fromCharCode(n[i]);
    return n = n.join("")
}

The port data always seems to decode to the same port, so if you can't figure out how to do it you can simply create a list for the most used ports.

Thank you for your findings! I will try to see if I can turn this into something usable for me :)

Edit: Might be a noobish question, but any idea how this function would look like in c#? :)


* - klatzen - Mar 14, 2017

(Mar 14, 2017 10:52 AM)Yani Wrote:  Yeah kind of, but it would take too much time for me to write it out for you. Good luck though 🤝

Okay, thanks anyway though ! :-)