Project-ET.py 文件源码

python
阅读 38 收藏 0 点赞 0 评论 0

项目:Project-ET 作者: p0rt22 项目源码 文件源码
def traceIP(target):
        try:
            base = GeoIP('GeoLiteCity.dat')
            data = base.record_by_addr(target)
            dnsName = socket.gethostbyaddr(target)[0]
            formatedData = '''IP: {}
City: {}
State/Province: {}
Country: {}
Continent: {}
Zip/Postal code: {}
Timezone: {}
Latitude: {}
Longitude: {}
DNS name: {}'''.format(target, data['city'], data['region_code'], data['country_name'], data['continent'], data['postal_code'], data['time_zone'], str(data['latitude']), str(data['longitude']), dnsName)
            print formatedData
            # compares target to database and print results to console

            askSave = raw_input('Save data? Y/n: ').lower()
            if askSave == 'y':
                ipFileName = raw_input('Filename: ')

                with open(ipFileName, 'w') as fileName:
                    fileName.write(formatedData)

                print 'Output saved as {}'.format(ipFileName)

            else:
                pass
            # asks user if they want to save the output

            pause()
            main()

        except socket.herror:
            pass
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号