Wardialing in the Modern World

7

1

Introduction

Wardialing was a very interesting way to try to hack people back in the '80s and '90s. When everyone used dial-up, people would dial huge amounts of numbers to search for BBS's, computers, or fax machines. If it was answered by a human or answering machine, it hung up and forgot the number. If it was answered by a modem or a fax machine, it would make note of the number.

"Of course, you realize this means War...dialing?" <--- Pun made by @Shaggy

Challenge

Your job is to make a URL wardialer. Something that tests and checks if it's a valid website from one letter of the alphabet.

Constraints

  • Program must take user input. This input has to be a letter of the alphabet, no numbers. Just one letter of the alphabet and form multiple URLs that start with the letter. Input letter will be lowercase, not uppercase.
  • Standard loopholes apply.
  • You must make 8 URLs from 1 letter, and test to see if it is a valid site.
  • If you hit an error (not a response code), instead of leaving it blank, go ahead and return a 404
  • If you hit a redirect (3xx), return a 200 instead.
  • You may output the results in any reasonable format, as long as it includes the website name, status codes for all the websites and the redirects.
  • This is , so shortest amount of bytes wins.

What counts as a URL for this challenge?

http://{domain-name}.{com or net or org}

For this challenge, the domain name should only be 4 letters long, no more, no less.

What should I test?

For each 4 letter domain name, test it against three top-level domains (.com, .net, .org). Record all the response codes from each URL, remember from the constraints that any (3xx) should return 200 and be recorded as a redirect in the output and any error getting to the website should result in a 404.

Input

a

Output

+---------+------+------+------+------------+
| Website | .com | .net | .org | Redirects? |
+---------+------+------+------+------------+
| ajoe    | 200  | 200  | 200  | .com, .net |
+---------+------+------+------+------------+
| aqiz    | 200  | 404  | 404  | no         |
+---------+------+------+------+------------+
| amnx    | 200  | 503  | 404  | .com       |
+---------+------+------+------+------------+
| abcd    | 200  | 404  | 200  | .com       |
+---------+------+------+------+------------+
| ajmx    | 200  | 503  | 404  | no         |
+---------+------+------+------+------------+
| aole    | 200  | 200  | 200  | .com       |
+---------+------+------+------+------------+
| apop    | 404  | 200  | 200  | .net       |
+---------+------+------+------+------------+
| akkk    | 200  | 200  | 200  | .com       |
+---------+------+------+------+------------+

KuanHulio

Posted 2017-05-23T15:37:59.867

Reputation: 883

1As a more modern human, what exactly was the point of wardialing? What did you use the numbers for? – Beta Decay – 2017-05-23T15:42:35.663

1@BetaDecay Typically, they were used to find computers, BBS's, or pretty much anything that could be connected to a computer modem. Once a number was found that could, the user could try to guess the user account to gain access to the system over dialup. – KuanHulio – 2017-05-23T15:46:28.777

Are you sure it's only in the 80s or 90s? 'Cause I often get calls that hang up after one second... – feersum – 2017-05-23T16:01:37.207

4

If you've seen the movie WarGames, I believe the protagonist does some of this.

– Stephen – 2017-05-23T16:02:23.877

1That's where the name wardialing came from, I assume @StephenS and well, it never really stopped but was more prominent in the 80s and 90s. Not a lot of people use dialup any more. – KuanHulio – 2017-05-23T16:04:12.027

Can the url contain numbers? – ovs – 2017-05-23T17:06:45.023

@ovs Yes it can contain numbers. – KuanHulio – 2017-05-23T17:10:08.287

How should we choose the 8 url's – ovs – 2017-05-23T20:58:49.700

At complete and utter randomness, the letter has to be at the beginning of each domain name – KuanHulio – 2017-05-23T21:00:20.167

I've heard the only winning move is not to play. – Bumpy – 2017-05-30T22:44:30.933

Apparently everyone thinks so too @Bumpy – KuanHulio – 2017-05-30T22:46:05.567

Oh? This one looked interesting. If I get a few moments when the boss isn't looking over my shoulder I'll give it a bash ;-) JS is my weapon of choice, and Justin's 249 is a tantalising target, though I'm sure I'll find he's removed every unnecessary byte. ;-) – Bumpy – 2017-05-30T22:59:26.253

Answers

0

Bash, 90 bytes

for i in $1{100..104}.{com,net,org};{ echo $i;(curl -IL $i 2>:||echo HTTP 404)| grep HTTP;}

Sample output:

b100.com
HTTP/1.1 301 Moved Permanently
HTTP/1.1 200 OK
b100.net
HTTP/1.1 301 Moved Permanently
HTTP/1.1 200 OK
b100.org
HTTP 404
b101.com
HTTP/1.1 301 Moved Permanently
HTTP/1.1 200 OK
b101.net
HTTP/1.1 406 Not Acceptable
b101.org
HTTP/1.1 406 Not Acceptable
b102.com
HTTP/1.1 200 OK
b102.net
HTTP 404
b102.org
HTTP 404
b103.com
HTTP/1.1 301 Moved Permanently
HTTP/1.1 200 OK
b103.net
HTTP 404
b103.org
HTTP 404
b104.com
HTTP/1.1 301 Moved Permanently
HTTP/1.1 200 OK
b104.net
HTTP/1.1 301 Moved Permanently
HTTP/1.1 200 OK
b104.org
HTTP 404

marcosm

Posted 2017-05-23T15:37:59.867

Reputation: 986

working on changes, need to transform 3XX in 200 and avoid user agent problems – marcosm – 2017-06-01T14:10:00.593

2

Python 2 + requests, 198 191 bytes

from requests import*
def f(c):
 for i in range(24):
	u='http://'+c+`i/3`*3+'.'+'cnooermtg'[i%3::3]
	try:a=get(u,allow_redirects=0).status_code
	except:a=404
	if a/100==3:a='200 R'
	print u,a

Sample output for a:

http://a000.com 404
http://a000.net 404
http://a000.org 404
http://a111.com 200
...
http://a666.org 502
http://a777.com 403
http://a777.net 200 R
http://a777.org 200

ovs

Posted 2017-05-23T15:37:59.867

Reputation: 21 408

I think the question was to produce all four-glyph names, not just the 1000 or so that start with a and end in a digit. The example output contains a test against ajoe.com which your code cannot check. – Draco18s no longer trusts SE – 2017-05-23T20:51:58.590

@Draco18s You must make 8 URLs from 1 letter, and test to see if it is a valid site. does not sound like we should generate all url's. – ovs – 2017-05-23T20:58:21.667

Ah, yes, I missed that. Carry on. – Draco18s no longer trusts SE – 2017-05-23T21:10:47.527

1

Ruby, 145 + 10 = 155 bytes

+ 10 bytes for command line arguments.

Probably not winning any beauty contests with this:

x=[*$<.getc+?a*3..?z*4]
24.times{|i|r=Net::HTTP.get_response(URI(p"http://#{x[i/3]}."+'comnetorg'[i*3%9,3])).code rescue"404"
p r=~/^3/?"200R":r}

Run with ruby -rnet/http wardialing.rb

Example:

$ ruby -rnet/http wardialing.rb <<< g
"http://gaaa.com"
"200R"
"http://gaaa.net"
"200"
"http://gaaa.org"
"200"
"http://gaab.com"
"200"
"http://gaab.net"
"200"
"http://gaab.org"
"200"
"http://gaac.com"
"404"

(etc)

daniero

Posted 2017-05-23T15:37:59.867

Reputation: 17 193

0

NodeJS, 249 246 bytes

-3 bytes thanks to @ASCII-only.

c=>{r=_=>Math.random().toString(36).slice(-3),o="",q=i=>(u=`http://${n=i%3?n:c+r()}.`+["com","net","org"][i%3],o+=u+" ",d=r=>(o+=(/^3/.test(s=r.statusCode||404)?"200R":s)+`
`,--i?q(i):console.log(o)),require("http").get(u,d).on("error",d)),q(24)}

Creates random three-letter strings from 1-9 and a-z for each domain. Redirects are shown as 200R.

Try it online
(Note: may take a minute or two to complete all requests)

Sample output

http://a9k9.com 200
http://a9k9.net 404
http://a9k9.org 404
http://a529.com 200
http://a529.net 404
http://a529.org 404
http://asor.com 200R
http://asor.net 404
http://asor.org 404

Longer version with table output, 278 bytes

c=>{r=_=>Math.random().toString(36).slice(-3),o=h=`name .com    .net    .org
`,q=i=>(i%3||(n=c+r(),o+=n+`    `),u=`http://${n}.`+h.substr(6+i%3*5,3),d=r=>(o+=(/^3/.test(s=r.statusCode||404)?"200R":s)+(++i%3?` `:`
`),i<24?q(i):console.log(o)),require("http").get(u,d).on("error",d)),q(0)}

Whitespace in name .com .net .org and n+` ` are literal tab characters.

Sample table output

name    .com    .net    .org
aa4i    200     200     200
a66r    404     404     404
anmi    200     200     403
aaor    403     200R    200R

Justin Mariner

Posted 2017-05-23T15:37:59.867

Reputation: 4 746

I followed the link to 'Try it online' but only got "undefined" as output. – Octopus – 2017-05-31T22:44:09.580

1@Octopus It takes a minute or two to complete all of the requests, and for some reason the online interpreter outputs "undefined" right at the start. Running locally from command line does not output that, though. I'll add that as a note to the post. – Justin Mariner – 2017-05-31T22:55:50.950

246: c=>{r=_=>Math.random().toString(36).slice(-3),o="",q=i=>(u=\http://%24%7Bn=i%3?n:c+r()%7D.%5C%60+%5B%27com%27,%27org%27,%27net%27%5D%5Bi%3%5D,o+=u+" ",d=r=>(o+=(/^3/.test(s=r.statusCode||404)?"200R":s)+` `,--i?q(i):console.log(o)),require("http").get(u,d).on("error",d)),q(24)}`

– ASCII-only – 2017-06-02T02:24:06.753

@ASCII-only thanks, updated. – Justin Mariner – 2017-06-02T18:02:45.407

0

PHP, 221 bytes

for($c=8;$c--;){$u=$argv[1];for($i=3;$i--;)$u.=chr(rand(97,122));for($z=0;$z<3;){$r="$u.".['com','net','org'][$z++];$h=get_headers("http://$r");$s=$h?substr($h[0],9,3):404;$t=(3==intval($s/100))?"200R":$s;echo"$r $t\n";}}

With CRs and indentation

for($c=8;$c--;){
    $u=$argv[1];
    for($i=3;$i--;)$u.=chr(rand(97,122));
    for($z=0;$z<3;){
        $r="$u.".['com','net','org'][$z++];
        $h=get_headers("http://$r");
        $s=$h?substr($h[0],9,3):404;
        $t=(3==intval($s/100))?"200R":$s;
        echo"$r $t\n";
    }
}

Sample output on 'b':

bnjz.com 404
bnjz.net 200
bnjz.org 404
bkxw.com 200
bkxw.net 200
bkxw.org 403
biak.com 200
biak.net 403
biak.org 200R
bpzb.com 200
bpzb.net 200
bpzb.org 404
bigr.com 404
bigr.net 200
bigr.org 200
bcei.com 404
bcei.net 200R
bcei.org 200
bexc.com 200
bexc.net 200
bexc.org 404
bset.com 404
bset.net 200
bset.org 200

Octopus

Posted 2017-05-23T15:37:59.867

Reputation: 819

0

q/kdb+, 392 378 300 276 bytes

Solution:

t:{
  w:y,($:)x;
  r:@[{"J"$-3#12#(`$":http://",x)y}[w;];"GET / HTTP/1.1\r\nHost:",w,4#"\r\n";404];
  (x,`w`r)!(r;`$y;$[(r>299)&r<400;[r:200;x];`])
  }
f:{
  R:(`w,x,`r)xcols(,/)each(x)t\:/:{x,/:3 cut 24?.Q.a}y;
  (`Website,x,`$"Redirects?")xcol update r:`No from R where r=`
  }[`.com`.org`.net;]

Example:

q)f"a"
Website .com .org .net Redirects?
---------------------------------
amik    200  200  200  .net      
abjl    200  200  503  No        
afuw    403  200  200  No        
agby    200  200  200  No        
afen    200  200  200  .net      
ajch    200  404  200  No        
aaro    200  200  200  No        
ajsr    200  404  503  No   

Notes:

Current solution is fairly hefty... Half the code is trying to fetch a URL, the other half is presenting the results nicely, unsure how much further I can golf this.

Explanation:

Function t

w:y,($:)x       // convert suffix (`.com) to string, prepend host and save in w
@[x;y;404]      // try function x with parameter y, on error return 404
"GET /..."      // HTTP GET request in shortest form
`:http://x y    // open web connection to x, send request y
-3#12#          // truncate output to 12 chars, take last 3 chars
"J"$            // cast result to long
$[x;y;z]        // if x then y, else z
(x)!(y)         // create a dictionary with x as keys, y as values

Function f

24?.Q.a         // take 24 random characters from a-z
x,/:3 cut       // cut into 3-character lists, prepend input 'x'
t\:/:           // call function t with each combination of left and right
(,/) each       // raze (reduce) each result
xcols           // re-order columns into output format
xcol            // rename columns

streetster

Posted 2017-05-23T15:37:59.867

Reputation: 3 635