推荐学习书目
› 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 · Dec 28, 2017 · 8890 views
    This topic created in 3239 days ago, the information mentioned may be changed or developed.
    luojianxhlxt
    luojianxhlxt
    Dec 28, 2017❤️1
    1
    wifi 密码无线属性、安全就能看
    公网 ip 用这个就行 http://www.net.cn/static/customercare/yourip.asp 。。。
    bitholic
    bitholic
    Dec 28, 2017❤️1
    2
    这不是用 shell 命令就行了吗,比如 mac 下:curl myip.ipip.net && security find-generic-password -wa wifi-name
    xomix
    xomix
    Dec 28, 2017
    3
    @bitholic ………………你直接上这个网站看看,这跟楼上的有什么区别…………
    agostop
    agostop
    Dec 28, 2017
    4
    哈哈哈
    ryahcs
    ryahcs
    Dec 28, 2017 via iPhone
    5
    ip111.cn 能看出国 ip 和代理 ip
    neosfung
    neosfung
    Dec 28, 2017
    6
    里面用到 nm-tool,在 ubuntu 16.04 已经被替换为 nmtui
    sxd
    sxd
    Dec 28, 2017
    7
    ng 和 angular-cli 重名了
    cls1991
    cls1991
    OP
    Dec 28, 2017
    8
    @neosfung 查了一下,15.04 就已经不支持,多谢了
    cls1991
    cls1991
    OP
    Dec 28, 2017
    9
    @sxd 老哥会玩。。
    cls1991
    cls1991
    OP
    Dec 28, 2017
    10
    @bitholic 原理一样
    zgzh
    zgzh
    Dec 28, 2017
    11
    获取公网 ip 我用 python -c "import socket; sock=socket.create_connection(('ns1.dnspod.net',6666)); print sock.recv(16); sock.close()"
    libowei
    libowei
    Dec 28, 2017
    12
    获取公网 ip 我都是从百度直接搜 ip
    cls1991
    cls1991
    OP
    Dec 28, 2017
    13
    @zgzh 666
    cls1991
    cls1991
    OP
    Dec 28, 2017
    14
    @libowei 方法都差不多
    est
    est
    Dec 28, 2017❤️1
    15
    macOS 看起来都是一行呢

    security find-generic-password -wa $(networksetup -getairportnetwork en0 | awk '{print $NF}' )
    est
    est
    Dec 28, 2017
    16
    @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
    cls1991
    OP
    Dec 28, 2017
    17
    @est 厉害,不过最好与网卡名无关,en0, 也可能是 en1, en2 等.

    /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I | grep ' SSID'
    qsnow6
    qsnow6
    Dec 28, 2017
    18
    @est #16 这个获取的是内网 IP 啊

    获取公网 IP 还是必须得发起链接吧
    est
    est
    Dec 28, 2017
    19
    @qsnow6 呃,这个是 dnspod 的特别服务么?
    est
    est
    Dec 28, 2017❤️1
    20
    @qsnow6 原来 dnspod 还能这样玩

    $ nc ns1.dnspod.net 6666


    不错。
    freshmanc
    freshmanc
    Dec 28, 2017
    21
    ➜ ~ curl ipinfo.io

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

    另外无脑安利 https://ip.sb
    zhangsen1992
    zhangsen1992
    Dec 28, 2017
    24
    xmbaozi
    xmbaozi
    Dec 28, 2017 via iPhone
    25
    jeffson
    jeffson
    Dec 28, 2017
    26
    curl ip.cn
    freshmanc
    freshmanc
    Dec 29, 2017 via Android
    27
    @cls1991 可能代理策略不对? 南京联通表示能用
    Va1n3R
    Va1n3R
    Dec 29, 2017
    28
    Windows 平台
    netsh wlan show profile
    netsh wlan show profile WiFi-name key=clear
    不要太好用。
    cls1991
    cls1991
    OP
    Dec 29, 2017
    29
    @Va1n3R windows 与语言有关,解析 command 结果,稍微繁琐一点,所以暂时没做对 windows 的支持;
    ps: 准备 windows 平台就简单支持中英文
    cls1991
    cls1991
    OP
    Dec 29, 2017❤️1
    30
    @freshmanc 哈哈, 其实是我网络比较卡,一直等待,加了代理, 直接就返回结果了。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1566 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 52ms · UTC 16:29 · PVG 00:29 · LAX 08:29 · JFK 11:29
    ♥ Do have faith in what you're doing.