text stringlengths 1 654k |
|---|
on Feb 7, 2015 |
8721 views - |
MUST WATCH: Why rape is a joke in India |
By: editorial |
on Feb 3, 2015 |
50094 views - |
What AbRam calls father Shahrukh Khan |
By: MoviezAddA |
on Feb 3, 2015 |
5271 views - |
Ekta Kapoors XXX Film Makers Launch Twitter Chocolate Cam... |
By: MoviezAddA |
on Feb 12, 2015 |
14925 views - |
Tapsee Pannu Visit the Rediff office |
By: editorial |
on Feb 4, 2015 |
30327 views - |
When Salman Khan got NAUGHTY with Deepika |
By: LehrenTV |
on Feb 2, 2015 |
7560 views - |
SHARE |
TWEET |
Untitled |
a guest Feb 11th, 2019 63 Never |
Not a member of Pastebin yet? Sign Up, it unlocks many cool features! |
1. #!/usr/bin/env python2 |
2. |
3. import socket |
4. import netifaces |
5. import struct |
6. import json |
7. import re |
8. from netaddr import IPNetwork, EUI |
9. import threading |
10. import binascii |
11. import time |
12. import errno |
13. from Queue import Queue |
14. |
15. # actual port scanner |
16. def p_scan(jdict, iface, plock, tar_ip, port): |
17. s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) |
18. s.settimeout(0.25) |
19. |
20. try: |
21. c = s.connect((tar_ip, port)) |
22. #resp = s.recv(1024) |
23. #print(len(resp)) |
24. with plock: |
25. print('\t\t...discovered open port %s on %s.' % (port, tar_ip)) |
26. jdict["machines"][iface][tar_ip]["tcp"][str(port)] = "unknown" |
27. |
28. c.close() |
29. except: |
30. pass |
31. |
32. # threader for port scanner |
33. def threader(jdict, iface, q, plock, tar_ip): |
34. while True: |
35. p = q.get() |
36. p_scan(jdict, iface, plock, tar_ip, p) |
37. q.task_done() |
38. |
39. # port scanner for all IPs found on each interface |
40. def scan_ports(jdict, iface): |
41. plock = threading.Lock() |
42. |
43. for ip in jdict["machines"][iface].keys(): |
44. tar_ip = socket.gethostbyname(ip) |
45. |
46. q = Queue() |
47. |
48. for x in range(50): |
49. t = threading.Thread(target = threader, args=(jdict, iface, q, plock, tar_ip)) |
50. t.daemon = True |
51. t.start() |
52. |
53. for p in range(1, 500): |
54. q.put(p) |
55. |
56. q.join() |
57. |
58. # find interface from jdict based on IP and MAC |
59. def loc_iface(jdict, dst_ip4, dst_mac): |
60. for iface in jdict["machines"]: |
61. if dst_ip4 in jdict["machines"][iface].keys(): |
62. #print('found ip4 %s in iface %s' % (dst_ip4, iface)) |
63. if jdict["machines"][iface][dst_ip4]["mac"] == dst_mac: |
64. #print('found mac %s' % (dst_mac)) |
65. return iface |
66. |
67. # handle ARP replies |
68. def recv_sock(s, jdict): |
69. resp = s.recvfrom(1024) |
70. |
71. eth_hdr = resp[0][0:14] |
72. eth_det = struct.unpack("!6s6s2s", eth_hdr) |
73. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.