(view source code of obscure.rex as plain text)
/* Initialize variables */
debug = 0
ip = ""
header = "0D0A"X||"Obscure.rex, Version 1.00"||"0D0A"X,
||"Obscure the specified URL by converting the host name to a decimal IP address"||"0D0A"X,
||"and by adding a hostname (either vake or valid) as a fake login name."||"0D0A"X
footer = "Note: Security settings of your browser may block use of decimal addresses"||"0D0A0D0A"X,
||"Written by Rob van der Woude"||"0D0A"X||"http://www.robvanderwoude.com"
explan = "Explanation:"||"0D0A"X,
||"Let us take the fictional http://somehost.com/sources/ and let's assume"||"0D0A"X,
||"somehost.com's IP address is 1.2.3.4. The decimal representation of the"||"0D0A"X,
||"IP address is: 1 * 256^3 + 2 * 256^2 + 3 * 256 + 4 = 16909060"||"0D0A"X,
||"(try pinging 16909060, it will show 1.2.3.4 as the address being pinged)"||"0D0A"X,
||"So the URL could also be written as http://16909060/sources/"||"0D0A"X,
||"Any URL may be preceded with a (fake) user ID followed by an @"||"0D0A"X,
||"So we can further obscure the URL by adding a (fake) host name:"||"0D0A"X,
||"http://fake.host@16909060/sources/ still points to http://somehost.com/sources/"||"0D0A"X
/* Hide external commands */
"@ECHO OFF"
Trace Off
/* Parse command line arguments */
Parse Arg url debug dummy
If url = "" Then Call Syntax
If dummy <> "" Then Call Syntax
If debug <> "" Then Do
If Translate( debug ) = "-DEBUG" Then Do
debug = 1
End
Else Do
Call Syntax
End
End
/* Split URL into protocol. host name and path */
Parse Value url With prot"://"host"/"path
If host = "" Then Do
prot = ""
Parse Value url With host"/"path
End
If path = "" Then Do
If Right( url, 1 ) = "/" Then path = "/"
End
Else Do
path = "/"||path
End
/* Convert host name to IP address using PING command */
"PING "||host||" -n 1 | RXQUEUE"
Do Until Queued() = 0
Parse Pull line
If Pos( "[", line ) > 0 Then Parse Value line With ."["ip"]".
End
/* Slit IP address into 4 octets */
Parse Value ip with ip1"."ip2"."ip3"."ip4
/* Error message if no 4 octets */
If ip4 = "" Then Do
Say
Say "Invalid host name or host not available"
Call Syntax "SHORT"
End
/* Add leading zeroes to octets if necessary, and concatenate 4 hex octets into 8 digit hex number */
iphex = Right( D2X( ip1 ), 2, "0" )||Right( D2X( ip2 ), 2, "0" )||Right( D2X( ip3 ), 2, "0" )||Right( D2X( ip4 ), 2, "0" )
/* Convert hexadecimal IP address to decimal */
Numeric Digits 10
ipdec = X2D( iphex )
/* Show intermediate results if requested */
If debug = 1 Then Do
Say
Say "URL = "||url
Say "Protocol = "||prot
Say "Host name = "||host
Say "IP Address = "||ip
Say "Hexadecimal IP = "||iphex
Say "Decimal IP = "||ipdec
Say "Path = "||path
End
If prot <> "" Then prot = prot||"://"
Say header
Say footer
Say
Say "Obscured URL examples:"
Say
Say " "||prot||ipdec||path
Say " "prot||"www.whateveryoulike.here@"||ipdec||path
/* Done */
Exit 0
Syntax:
Say
Say header
Say
Say "Usage: OBSCURE.REX url [ -DEBUG ]"
Say
Say 'Where: "url" can be any valid URL, host name or IP address'
Say ' "-DEBUG" displays intermediate results'
Say
If Arg( 1 ) <> "SHORT" Then Say explan
Say footer
Exit 1
Return
page last modified: 2024-04-16; loaded in 0.0141 seconds