Skip to content

Instantly share code, notes, and snippets.

@gr33n7007h
Created January 18, 2016 06:28
Show Gist options
  • Save gr33n7007h/0e16f06bfcd98b9a6d05 to your computer and use it in GitHub Desktop.
Save gr33n7007h/0e16f06bfcd98b9a6d05 to your computer and use it in GitHub Desktop.
#!/usr/bin/env lua
local socket = require('socket')
local s = assert(socket.tcp())
s:connect('www.google.co.uk', 80)
s:send('GET /robots.txt HTTP/1.1\r\n\r\n')
while true do
local line = s:receive('*l')
if line:match('Disallow: (.+)') then
local path = line:match('Disallow: (.+)')
print('path: ' .. path)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment