今日は、タイトルを書いて、スクリプトの実行を与えられています
次のようにスクリプト
#!/ usr /ビン/ ENVのpython3 #_ * _コード:UTF-8 _ * _ インポートBASE64 #字典文件路径 dic_file_path = ' ./10_million_password_list_top_100.txt ' 開く(dic_file_path、' R ' )Fとして: password_dic = F。 readlines() ユーザ名 = ' 管理者:' #用户名 のためのパスワードでpassword_dic: encodestr = base64.b64encode(" 管理者:" + password.strip()) プリント(encodestr)
次のように考えます
トレースバック(最新の呼び出しの最後): ファイル" D:/ pythonのファイル/ CTF / ctfhub HTTP基础认证密码/密码ペイロード生成の.py "、12行、で、<モジュール> encodestr = base64.b64encode(" 管理者:" + パスワード.strip()) ファイル" D:\ OBJ \ WINDOWS-リリース\ 37amd64_Release \ msi_python \ zip_amd64 \ base64.py "、行58、中b64encode エンコード = binascii.b2a_base64(S、改行= Falseの) 例外TypeError:Aバイト様オブジェクトがされ、必要ではない 「STR 」
手段上記の最後の文「タイプエラー:バイトのようなオブジェクトではなく、文字列」。
そして、次のスクリプトに変更
#!/ usr /ビン/ ENVのpython3 #_ * _コード:UTF-8 _ * _ インポートBASE64 #字典文件路径 dic_file_path = ' ./10_million_password_list_top_100.txt ' 開く(dic_file_path、' R ' )Fとして: password_dic = F。 readlines() ユーザ名 = ' 管理者:' #用户名 のためのパスワードでpassword_dic: STR1 = str.encode(ユーザ名+ password.strip()) encodestr = base64.b64encode(STR1) encodestr =STR(encodestr) encodestr = encodestr.strip(' B \' " ) encodestr = encodestr.replace(" = "、" \ = ") #避免『=』被转译 プリント(encodestr)
成功した操作