text
stringlengths
1
654k
174. # obtain local interface information and initialize json dictionary
175. def init_local():
176.     jdict = {}
177.     jdict["machines"] = {}
178.  
179.     nmdict = {}
180.    
181.     # get interfaces on host machine
182.     ipv4 = ""
183.     mac = ""
184.     netmask = ""
185.  
186.     for iface in netifaces.interfaces():
187.         # ignore localhost interface
188.         if iface == 'lo' or iface == 'wlp2s0':
189.             continue
190.  
191.         addresses = netifaces.ifaddresses(iface)
192.         for inet_type in addresses:
193.             for _addr in addresses[inet_type]:
194.                 if re.match(r'^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$', _addr["addr"]):
195.                     mac = _addr["addr"]
196.                 if re.match(r'^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$', _addr["addr"]):
197.                     ipv4 = _addr["addr"]
198.                     netmask = _addr["netmask"]
199.         print('Located interface...\n\tName: %s\n\tIPv4: %s\n\tMAC:  %s\n\tNetmask: %s\n' % (iface, ipv4, mac, netmask))
200.         jdict["machines"][iface] = {}
201.         jdict["machines"][iface][ipv4] = {}
202.         jdict["machines"][iface][ipv4]["mac"] = mac.upper()
203.         jdict["machines"][iface][ipv4]["tcp"] = {}
204.  
205.         nmdict[iface] = netmask
206.    
207.     print(str(jdict) + '\n')
208.     print(str(nmdict) + '\n')
209.     print('JSON dict succesfully initialized with all local interfaces.')
210.     print('Netmask dict successfully loaded with all interfaces and their netmasks.\n')
211.     print('Moving on to network scan...')
212.  
213.     return (jdict, nmdict)
214.  
215. if __name__ == "__main__":
216.     (jdict, nmdict) = init_local()
217.     scan_net(jdict, nmdict)
218.  
219.     # we've gotten all the devices, now port scan them
220.     for iface in jdict["machines"]:
221.         print('Beginning port scan for interface %s.' % (iface))
222.         scan_ports(jdict, iface)
223.  
224.     with open("results.json", "w") as results:
225.         json.dump(jdict, results, sort_keys=True, indent=4)
226.  
227.     results.close()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top
About Edible Arrangements
3754 East Flamingo Road
Las Vegas, NV89121
702.433.2491
Edible Arrangements Deals in Las Vegas
Sign up to get alerts as soon as new deals are found.
Top Deals Nearby
45% Off
Full-Service Deluxe Hand Car Wash at Oasis Hand Car Wash (Up to 45% Off)
Nearby • Las Vegas • 0.39 mi
38% Off
Tulasara Custom Facial at Aveda Institute Las Vegas (Up to 38% Off). Three Options Available.
Nearby • Las Vegas • 1.66 mi
10% Off
10% Off Monitoring Services
Nearby • Las Vegas • 2.13 mi
20% Off
20% Off for Online Searches
Nearby • Las Vegas • 2.13 mi
78% Off
5 or 10 Pole Dance Classes or Night Club Atmosphere Pole Party for Six at Sunnys (Up to 78% Off)
Nearby • Las Vegas • 2.38 mi
Sale
$25 for Unlimited Buffet, Drinks, Rides, and Video Games at John's Incredible Pizza ($73.98 Value)
Nearby • Las Vegas • 2.4 mi
41% Off
Snorkel with Stingrays or Play with Otters at SeaQuest Las Vegas (Up to 41% Off). Five Options Available.
Nearby • Las Vegas • 2.43 mi
10% Off
10% Off Printing Services
Nearby • Las Vegas • 2.55 mi
54% Off
Day Pass or Climbing Membership at Nevada Climbing Center (Up to 54% Off). Five Options Available.
Nearby • Las Vegas • 2.72 mi
40% Off
Admission for One or Four to Ethel M Chocolates Tasting Room Experience (Up to 40% Off)
Nearby • Henderson • 3.1 mi
58% Off
Bowling for Up to Five or a Two-Hour Party Venue Rental at Wildfire Lanes (Up to 58% Off)
Nearby • Henderson • 3.31 mi
38% Off
Spa Admission and More at Imperial Health Spa (Up to 38% Off). Three Options Available.
Nearby • Las Vegas • 3.33 mi