V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
cls1991
V2EX  ›  Python

快速获取 wifi 密码,公网 IP

  •  1
     
  •   cls1991 · 2017-12-28 08:27:45 +08:00 · 7107 次点击
    这是一个创建于 2283 天前的主题,其中的信息可能已经有所发展或是发生改变。
    luojianxhlxt
        1
    luojianxhlxt  
       2017-12-28 08:56:02 +08:00   ❤️ 1
    wifi 密码无线属性、安全就能看
    公网 ip 用这个就行 http://www.net.cn/static/customercare/yourip.asp 。。。
    bitholic
        2
    bitholic  
       2017-12-28 09:02:50 +08:00   ❤️ 1
    这不是用 shell 命令就行了吗,比如 mac 下:curl myip.ipip.net && security find-generic-password -wa wifi-name
    xomix
        3
    xomix  
       2017-12-28 09:40:37 +08:00
    @bitholic ………………你直接上这个网站看看,这跟楼上的有什么区别…………
    agostop
        4
    agostop  
       2017-12-28 09:44:56 +08:00
    哈哈哈
    ryahcs
        5
    ryahcs  
       2017-12-28 09:56:41 +08:00 via iPhone
    ip111.cn 能看出国 ip 和代理 ip
    neosfung
        6
    neosfung  
       2017-12-28 10:08:30 +08:00
    里面用到 nm-tool,在 ubuntu 16.04 已经被替换为 nmtui
    sxd
        7
    sxd  
       2017-12-28 10:11:00 +08:00
    ng 和 angular-cli 重名了
    cls1991
        8
    cls1991  
    OP
       2017-12-28 10:15:27 +08:00
    @neosfung 查了一下,15.04 就已经不支持,多谢了
    cls1991
        9
    cls1991  
    OP
       2017-12-28 10:16:39 +08:00
    @sxd 老哥会玩。。
    cls1991
        10
    cls1991  
    OP
       2017-12-28 10:17:50 +08:00
    @bitholic 原理一样
    zgzh
        11
    zgzh  
       2017-12-28 11:41:18 +08:00
    获取公网 ip 我用 python -c "import socket; sock=socket.create_connection(('ns1.dnspod.net',6666)); print sock.recv(16); sock.close()"
    libowei
        12
    libowei  
       2017-12-28 12:00:52 +08:00
    获取公网 ip 我都是从百度直接搜 ip
    cls1991
        13
    cls1991  
    OP
       2017-12-28 13:08:41 +08:00
    @zgzh 666
    cls1991
        14
    cls1991  
    OP
       2017-12-28 13:10:23 +08:00
    @libowei 方法都差不多
    est
        15
    est  
       2017-12-28 13:19:00 +08:00   ❤️ 1
    macOS 看起来都是一行呢

    security find-generic-password -wa $(networksetup -getairportnetwork en0 | awk '{print $NF}' )
    est
        16
    est  
       2017-12-28 13:26:12 +08:00
    @zgzh

    可以

    $ python -c 's=__import__("socket").socket(2,2);s.connect(("8.8.8.8", 8));print(s.getsockname()[0])'
    172.x.x.x

    根本不用发起连接。
    cls1991
        17
    cls1991  
    OP
       2017-12-28 13:28:43 +08:00
    @est 厉害,不过最好与网卡名无关,en0, 也可能是 en1, en2 等.

    /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I | grep ' SSID'
    qsnow6
        18
    qsnow6  
       2017-12-28 13:32:14 +08:00
    @est #16 这个获取的是内网 IP 啊

    获取公网 IP 还是必须得发起链接吧
    est
        19
    est  
       2017-12-28 13:41:26 +08:00
    @qsnow6 呃,这个是 dnspod 的特别服务么?
    est
        20
    est  
       2017-12-28 13:43:14 +08:00   ❤️ 1
    @qsnow6 原来 dnspod 还能这样玩

    $ nc ns1.dnspod.net 6666


    不错。
    freshmanc
        21
    freshmanc  
       2017-12-28 15:15:57 +08:00
    ➜ ~ curl ipinfo.io

    还能看地理位置啥的(没什么用...
    cls1991
        22
    cls1991  
    OP
       2017-12-28 15:24:00 +08:00
    @freshmanc 需要翻墙, 返回的都是代理 IP 的信息
    chenyiping1995
        23
    chenyiping1995  
       2017-12-28 16:37:02 +08:00 via Android
    查看公网 IP 一行 curl ip.cn 不就结束了么……为何要用 Python WebSocket?

    另外无脑安利 https://ip.sb
    zhangsen1992
        24
    zhangsen1992  
       2017-12-28 18:25:20 +08:00
    xmbaozi
        25
    xmbaozi  
       2017-12-28 18:27:11 +08:00 via iPhone
    jeffson
        26
    jeffson  
       2017-12-28 18:35:52 +08:00
    curl ip.cn
    freshmanc
        27
    freshmanc  
       2017-12-29 00:36:09 +08:00 via Android
    @cls1991 可能代理策略不对? 南京联通表示能用
    Va1n3R
        28
    Va1n3R  
       2017-12-29 02:06:55 +08:00
    Windows 平台
    netsh wlan show profile
    netsh wlan show profile WiFi-name key=clear
    不要太好用。
    cls1991
        29
    cls1991  
    OP
       2017-12-29 08:47:26 +08:00
    @Va1n3R windows 与语言有关,解析 command 结果,稍微繁琐一点,所以暂时没做对 windows 的支持;
    ps: 准备 windows 平台就简单支持中英文
    cls1991
        30
    cls1991  
    OP
       2017-12-29 08:48:54 +08:00   ❤️ 1
    @freshmanc 哈哈, 其实是我网络比较卡,一直等待,加了代理, 直接就返回结果了。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2428 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 15:57 · PVG 23:57 · LAX 08:57 · JFK 11:57
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.