Ip Safe Python Script
Good for Spammers Hackers Carders Pentesters
2 Files Save in 1 Folder
file save :- ipsafe.py
file save :- agencies.xml
save agencies in xml file download link :- http://paste.security-portal.cz/view/raw/ce5f260f
Good for Spammers Hackers Carders Pentesters
2 Files Save in 1 Folder
file save :- ipsafe.py
file save :- agencies.xml
save agencies in xml file download link :- http://paste.security-portal.cz/view/raw/ce5f260f
Code:
import sys
import xml.etree.ElementTree as et
class AgencyXmlReader:
def __init__(self, fname):
self.xmlDoc = et.parse(fname).getroot()
def agencies(self):
agencies = [];
for agency in self.xmlDoc:
name = agency[0].text
ipStart = agency[1].text
ipEnd = agency[2].text
agencies.append(Agency(name,ipStart,ipEnd))
return agencies
class Agency:
def __init__(self, name, ipStart, ipEnd):
self.name = name
self.ipStart = ipStart
self.ipEnd = ipEnd
self.ipStartParts = self._parts(ipStart)
self.ipEndParts = self._parts(ipEnd)
def name(self):
return self.name
def ipStart(self):
return self.ipStart
def ipEnd(self):
return self.ipEnd
def isIpInRange(self,ip):
ipParts = self._parts(ip)
contained=True
for i in range(0,4):
if self.ipStartParts[i] <= ipParts[i] <= self.ipEndParts[i]:
continue
else:
contained = False
break
return contained
def _parts(self,ip):
return [int(x) for x in ip.split('.')]
def main():
if len(sys.argv) < 2:
print("Usage: python ipsafe.py <ip address>")
exit(1)
ip = sys.argv[1]
axr = AgencyXmlReader("agencies.xml")
agencies = axr.agencies()
isSafe = True
for agency in agencies:
if agency.isIpInRange(ip):
name = agency.name
ipStart = agency.ipStart
ipEnd = agency.ipEnd
print(ip + " is not safe, because it's controlled by the FBI.")
print("The ip is associated with agency " + name + ".")
print("The agency uses the following ip range [" +
ipStart +
" - " +
ipEnd +
"]")
print(ip + " falls in range.")
isSafe = False
break
if isSafe:
print(ip + " is safe.")
main()












