[All] encode your URL so cant be recognized but works

Share your advanced PureBasic knowledge/code with the community.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

[All] encode your URL so cant be recognized but works

Post by BackupUser »

Code updated for 5.20+
Restored from previous forum. Originally posted by ricardo.

Hi,

For some obscure reason some one may want to obscure its URL.
Per example, imagine that we want to obscure http://www.purebasic in a way that the resulting URL is:

[url]http://www.microsoft.com@%77%77%77%2E%70%75%72%65%62%61%73%69%63%2E%63%6F%6D[/url]

or even

[url]http://www.cnet-winning-award-software.com@%77%77%77%2e%70%75%72%65%62%61%73%69%63%2e%63%6f%6d/[/url]

I made a little app that let you do this:

Code: Select all


If OpenWindow(0,100,150,640,220,"Test",#PB_Window_SystemMenu)
  
  StringGadget(1,10,30,500,20,"[url]http://www.purebasic.com[/url]");write here the url you want to obscure
  StringGadget(2,10,90,500,20,"[url]http://www.microsoft.com[/url]");use any text with out @
  StringGadget(3,10,60,500,20,"")
  StringGadget(4,10,120,500,20,"")
  ButtonGadget(5,200,150,150,25,"Obscure your Url")
  ButtonGadget(6,510,60,120,20,"Copy to ClipBoard")
  ButtonGadget(7,510,120,120,20,"Copy to ClipBoard")
  TextGadget(8,520,30,100,20,"Here goes your URL")
  TextGadget(9,520,90,140,20,"Here goes tricky URL")
  Repeat
    EventID=WaitWindowEvent()
    
    Select EventID
    
      Case #PB_Event_Gadget
        Select EventGadget()
          Case 5
          String$ = ""
          For i = 1 To Len(GetGadgetText(1))
            If Mid(GetGadgetText(1),i,1) = "\" Or Mid(GetGadgetText(1),i,1) = "/"
               Letter$ = "%" + Hex(Asc(Mid(GetGadgetText(1),i,1)))
            Else
               Letter$ = "\"
            EndIf
            String$ = String$ + Letter$
          Next i
          SetGadgetText(3,String$)
  
          SetGadgetText(4, GetGadgetText(2) + "@" + String$)
          
          Case 6
          SetClipboardText(GetGadgetText(3)) 
          Case 7
          SetClipboardText(GetGadgetText(4)) 
          
        EndSelect
    
    EndSelect
    
  Until EventID=#PB_Event_CloseWindow
EndIf
Dont use slash (/ or \) into the "tricky URL" (http://www.microsoft.com or http://www.cnet-winning-award-software.com in the examples).

Try it and let me know if you find better and evil ways :evil: to trick the browser and the users : )

Best Regards

Ricardo

Dont cry for me Argentina...
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by PB.

First a tip for anonymous E-Mails, and now an URL encryptor?
What the heck are you up to, Ricardo? :)


PB - Registered PureBasic Coder
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by ricardo.
Originally posted by PB

First a tip for anonymous E-Mails, and now an URL encryptor?
What the heck are you up to, Ricardo? :)
Ha ha ha ha
Im just curios

Best Regards

Ricardo

Dont cry for me Argentina...
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by MrVainSCL.

Hi ricardo
Nice stuff and really very interested (now i know what all the % stuff behind a link means and how to read it :wink: Nice work! Thnx!

PIII450, 256MB Ram, 6GB HD, RivaTNT, DirectX8.1, SB AWE64, Win2000 + all Updates...

greetz
MrVainSCL! aka Thorsten
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by ricardo.


Hi MrVainSCL

Yes, its interesting. Sometimes could be so usefull if you want to difficult that some people get some URL.

I found that everything you write at the left of @ its not relevant since you dont uses / or \.
Its the same to type:

[url]http://www.take-a-look-at-this.com@http://www.purebasic.com" target="_blank[/url]

or even obscuring the http://www.purebasic part to get

[url]http://www.take-a-look-at-this.com@%77%77%77%2E%70%75%72%65%62%61%73%69%63%2E%63%6F%6D[/url]

Event the @ could be trated as %44...

sometimes people uses the left information to set the username and password

username:password@http://www.purebasic.com

It could be so usefull if you are making some server or maybe a webbrowser.




Best Regards

Ricardo

Dont cry for me Argentina...
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by ricardo.

This one works too:

http://www.download.com|bestsoftware.html@%77%77%77%2e%70%75%72%65%62%61%73%69%63%2e%63%6f%6d/

or

http://www.microsoft.com|billgates|favoritecompilers.html@%77%77%77%2e%70%75%72%65%62%61%73%69%63%2e%63%6f%6d/

Click the links :)

ps. there are another ways to obscure the URL ¿anyone else knows another way?

Best Regards

Ricardo

Dont cry for me Argentina...
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by fweil.

Hello Ricardo,

It is one easy trick to do first of all that is strange for most people :

take IP address instead of DNS name and convert it in a 32 bit integer instead of a 4 bytes dot separated number.

The problem is that many servers have a name resolution based on domain names splitted on the same IP address. But it is often on build URLs.

I mean if you want to place the long integer based URL of :

http://www.reelmediaproductions.com/pb

you can type

http://1123346314/pb/

which is also equivalent to :

http://%31%31%32%33%33%34%36%33%31%34/pb/

Funny, isn't it ?

I do not reveal any secret here, it is exactly how IP4 works !

Hope you will provide us some good stuff with it.

KRgrds

Francois Weil
14, rue Douer
F64100 Bayonne
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Paul.
Originally posted by fweil

I mean if you want to place the long integer based URL of :

http://www.reelmediaproductions.com/pb

you can type

http://1123346314/pb/

which is also equivalent to :

http://%31%31%32%33%33%34%36%33%31%34/pb/

Funny, isn't it ?

http://1123346314/pb/
Do you actually get this to work or is it just an example of what it would look like if it did work?

I know you can use http://66.244.231.138/pb instead of http://www.reelmediaproductions.com/pb
but http://1123346314/pb/ does not work here.

Visit the PB Resources Site at http://www.reelmediaproductions.com/pb
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by traumatic.
Originally posted by fweil
you can type
http://1123346314/pb/
which is also equivalent to :
http://%31%31%32%33%33%34%36%33%31%34/pb/

Funny, isn't it ?
This doesn't work on all browsers.
IE doesn't resolve these dword ips since v5.5 (and updated v5.0)
AFAIK on Netscape it never worked, same for Opera (correct me if I#M wrong)



--------
good programmers don't comment their code. it was hard to write - should be hard to read!
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Franco.

> but http://1123346314/pb/ does not work here.

Works here on Mozilla v1 and W2k-Sp3 :)

Have a nice day...
Franco

Sometimes you have to go a lonely way to accomplish genius things.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by ricardo.
Originally posted by Franco

> but http://1123346314/pb/ does not work here.
Works here with IE6 on XP.

How do i convert IP dotten on 32 bit integer????



Best Regards

Ricardo

Dont cry for me Argentina...
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by ricardo.

How do i convert IP dotten on 32 bit integer????

using PureBasic

Best Regards

Ricardo

Dont cry for me Argentina...
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by fweil.

Sorry that it could occur the long integer coding won't work but it should. I have an IE 5.5 on which it works.

Anyway the coding is really simple to find.

Assume you just know the DNS name of a server you want to 'code'. Make a ping of that server to get the exact IP address. Or sometimes you will check using a ping -a for solving the real DNS name and understand it is a redirection to the given domain you want to reach.

Anyway using ping you will get a b4.b3.b2.b1 (b for byte) IP addres. The long integer equivalence is :

b4 * 256 * 256 * 256 + b3 * 256 * 256 + b2 * 256 + b1

That's all !

BTW all the IP4 coding is based on this 'algorithm'.

...

Francois Weil
14, rue Douer
F64100 Bayonne
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by traumatic.
Works here with IE6 on XP.
How do i convert IP dotten on 32 bit integer????
doesn't work for me, ie6 / xp.
doesn't work on ie5.5 for me but on 5.0
strange...

however, for those interested further:
ore information on this can be found here:
http://www.pc-help.org/obscure.htm




--------
good programmers don't comment their code. it was hard to write - should be hard to read!
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by fweil.

Well traumatic ... this is a good article to understand this stuff.

Nice.

Francois Weil
14, rue Douer
F64100 Bayonne
Post Reply