amiralbenz

IP tracking omegle chat

Sep 8th, 2015
552
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.49 KB | None | 0 0
  1. #!/usr/bin/env python
  2. #Pcapy: http://www.coresecurity.com/corelabs-research/open-source-tools/pcapy
  3. #Impacket: http://www.coresecurity.com/corelabs-research/open-source-tools/impacket
  4. #Python GeoIP api: https://pypi.python.org/pypi/GeoIP/
  5. #GeoIP: http://dev.maxmind.com/geoip/legacy/geolite/
  6. from __future__ import print_function
  7. import pcapy
  8. import GeoIP
  9. from impacket.ImpactDecoder import *
  10.  
  11. gi = GeoIP.open("/usr/local/share/GeoIP/GeoLiteCity.dat", GeoIP.GEOIP_STANDARD)
  12. ips=[]
  13. dev="";
  14. ips.append("192.168.1.100")
  15. ips.append("192.168.1.1")
  16. def track(ip):
  17.     for sr in ips:
  18.         if ip==sr:
  19.             return
  20.     gir=gi.record_by_addr(ip)
  21.     ips.append(ip)
  22.     if gir is not None:
  23.         print(str(gir))
  24.         print(ip)
  25. print("Devices:")
  26. devices = pcapy.findalldevs()
  27. for d in devices :
  28.     print("\t- "+d)
  29. dev = raw_input('Enter device name: ')
  30. cap = pcapy.open_live(dev , 1024 , 1 , 0)
  31. cap.setfilter('udp')
  32.  
  33. def recv_pkts(hdr, data):
  34.     p= EthDecoder().decode(data)
  35.     packet=str(p)
  36.     count=0
  37.     for item in packet.split("\n"):
  38.         count+=1
  39.     #print(count)
  40.     #print(packet)
  41.     if count==67:
  42.         #print packet.splitlines()[1];
  43.         if (packet.splitlines()[1])[0:5] == "IP DF":
  44.             track((packet.splitlines()[1])[6:(packet.splitlines()[1]).index('>')-2])
  45.         else:
  46.             track((packet.splitlines()[1])[3:(packet.splitlines()[1]).index('>')-2])
  47.  
  48.  
  49.  
  50.  
  51. track("1.1.1.1")
  52. packet_limit = -1
  53. cap.loop(packet_limit,recv_pkts)
Advertisement
Add Comment
Please, Sign In to add comment