Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b9dcee6 commit 12db3bfCopy full SHA for 12db3bf
get_local_wip.py
@@ -0,0 +1,28 @@
1
+#encoding: utf-8
2
+import requests
3
+from bs4 import BeautifulSoup
4
+
5
6
+# 获取公网出口IP
7
+def get_out_ip(url):
8
+ r = requests.get(url)
9
+ txt = r.text
10
+ ip = txt[txt.find("[") + 1: txt.find("]")]
11
+ print('ip:' + ip)
12
+ return ip
13
14
15
+def get_real_url(url=r'http://www.ip138.com/'):
16
17
18
+ soup = BeautifulSoup(txt,"html.parser").iframe
19
+ return soup["src"]
20
21
22
+if __name__ == '__main__':
23
+ ip = get_out_ip(get_real_url())
24
+ with open("result.log", "a") as f:
25
+ print >>f, ip
26
27
+#pip install pyinstaller
28
+#pyinstaller -F get_local_wip.py >> dist/get_local_wip.exe
0 commit comments