首页   注册   登录
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python 学习手册
Python Cookbook
Python 基础教程
Python Sites
PyPI - Python Package Index
http://www.simple-is-better.com/
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
华为云
V2EX  ›  Python

Python 的 b64encode 被插入 "Administrator" Sid: S-1-5-21 的问题。

  •  
  •   Weakdancer · 2015-11-05 11:59:43 +08:00 · 1701 次点击
    这是一个创建于 1107 天前的主题,其中的信息可能已经有所发展或是发生改变。

    这样的配置

    layer_height=0.2
    wall_thickness=0.8
    retraction_enable=True

    经过

    def getProfileString():
    ret = '\b'.join(p) + '\f' + '\b'.join(alt)
    ret = base64.b64encode(zlib.compress(ret, 9))
    return ret

    之后
    成为:

    eNrtW1tv27gSfhWM/RHEedrFNj662E2zhh7axEkD5GLECprmRaAl2uZWEgWKinNB/vsZkpIsJVaSdtOcpGsDtarhDC9z/YaII3xFuD8ndDYXrtm1jQWOIl/MafAtIVkGpL7BieA4EJQlPknwJCKux3NiZCyioR+pCZYCljGlMENIkoyKK9c2jYRdX0fEz+g1gel6RsppIvwsJSR0HbN4FSROCcci58S1tvr3qfZqsuOumKFXESckbEzdN40sT1PGhXvEEmKkERZTxmMfh3OSwQk1ueDxwxxHPrkUPFdjn5iYGwuaEl+wBeHuLo4yUiP4FyzKY+La/TqRJKWWkjyegJhpMHYNCplTEoVal6AzHBPYcEjhKYDJ6m7275PtFrpUwz1ir06cRmzhWqbZNev21Fbo3aHimOWJcHtN2ytlFEONgZgmPrxckAh21xgJWDyhyUyfsSlB44ZqYQd2nWPOUkkzJkwIFjcc0jGUNk1/QUMx96cgwbg8msEmf5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Iq/pBRhZ7wgWoCnT6g3QZYAM1BtQHHNs1HhFUpKlyowHkYAbSG/U2Zgi1TpWrJoe873kmfg1UJdBQoYzGR2pTDKQdzgK+rKPsTejld8WRpgjiDrzvGBAgEvRc6R3larAlRgMotVdshFyRBMZPzbpkFcAE08oha1NRn//0qNwvdorQ6eGyavYMtq93KblE6CAOHKg6wwFcq37VOmgmSQkRnysg1xHafcyWEG0wISYsaYdmyRkDEmU8gDCCpMFCIbGnAn2e3DU+u+6qhoKG97lfW/cq6X/lp/Uqv1VBLoLgaIWgbn6wUfXq741mvtONRi0ijQOq/WX3DevuikOYFW7zHjv3s7d4gppwzfrbs//T4kv7aEP7KHT/QENwfXTXXv/yUj3euOl090rlWDa4DbN7o9CE261fqg9dO+RNO+co69p9TsN98wy+rY1u9Wl0z27jf0sWA8533AvbDFwOe+Z13A4U3ru8T1vcJb+Q+wSkjYH1N8H++JnjGW4I3cklQC9DWICyuAGqRen6fpQASLVlDJZzib6ZQKM9p9eO449lPqsY2RM4/rMW2unxvu3l/3lbVfqRBt/6Nh35B3PWSx/5RnFQDSBIEVSVgCFbf24b/viD6kTL2GjH9EGLqPydgestg6S7m0dCmt4Y2rwra2M8HbdYo6cVQkvOk2tmDTf9CgOFp0ND5tQ69hoZraHgHGvbeGjSUMs4aTq7h5PPCyeLHHvUfDFTE5Z+X6d+qNJgUpcbBCdTYgHSD7MI1wAg6zQwLv6wAq04+EyIWEJnq0EHOuVJx6cLSAMrQQKmo79BiDgJVpCswEeeRoGlUpQuedTsDbw5KlatJ5QK8UV6uvEhO6v2e/GGATsRr2h+eygAst/c/Ejt5Xg==))
    

    可以看到压缩并编码的内容。

    这段内容是插入到文件里的,但是偶尔(就是没有成功重现过,大概是在用户第一次使用软件的时候,我的电脑从来没有出现过)会在中间插入一段文字

    "Administrator" Sid: S-1-5-21-1987871192-1803184254-2498118558-500

    最后有个换行。
    变成这样:

    ....XMkMfUQip2COqEJ"Administrator" Sid: S-1-5-21-1987871192-1803184254-2498118558-500
    e4arFR1FNLwA0Tk/ZBgmAWzrQvbe89WVKGY/vUi5....

    我认为这个问题是出在 b64encode 环节的。
    google python sid b64encode 找不到任何思路。

    我的思路是不是错了?

    4 回复  |  直到 2015-11-05 13:24:56 +08:00
        1
    fangdingjun   2015-11-05 12:24:52 +08:00
    检查你的代码有没有多线程写文件,或者文件名冲突的情况,
    其次检查出问题的电脑上有没有什么卫士,助手,管家之类的,
    如果在干净的系统环境下也会出问题, 100%是你代码的问题
        2
    Weakdancer   2015-11-05 13:05:22 +08:00
    @fangdingjun 谢谢。
    主要是这个问题不知道怎么重现,在出问题的电脑上也是只出一次,之后再也不会出现了。
    之后的意思是什么都不修改,不管有没有管家什么的都没有关闭或者打开。
        3
    hahastudio   2015-11-05 13:13:16 +08:00
    base64, zlib 怎么可能会去拿你的系统的 SID= =
    很明显是你给它的内容就多了一行
    为什么会认为是编码有问题呢= =
        4
    Weakdancer   2015-11-05 13:24:56 +08:00
    @hahastudio 我也认为 base64 不会取 Sid ,但是怎么解释 sid 出现在 base64 编码的中间呢?
    把 sid 去掉之后还是能够重新解码的。
    这个代码不是我写的。是开源的 3d 打印切片软件。

    https://github.com/daid/Cura/blob/SteamEngine/Cura/util/profile.py#L863
    关于   ·   FAQ   ·   API   ·   我们的愿景   ·   广告投放   ·   感谢   ·   实用小工具   ·   1081 人在线   最高记录 3821   ·  
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.1 · 21ms · UTC 17:49 · PVG 01:49 · LAX 09:49 · JFK 12:49
    ♥ Do have faith in what you're doing.
    沪ICP备16043287号-1