私は、対話型シェルのヘルプメニューを作成していますが、これはフォーマット済みの方法でリストを出力するためのものです。このプログラムはすでにargparseを使用しています。スクリプト(ターミナル)のコマンドラインインターフェイスにリダイレクトされます。スペースでヘルプメニューを書式設定する
Command Secondary-Command Descriptor
-d dork (Do a dork check to verify if your dork is good)
-f proxy (Find usable proxies)
-v verify (Verify the algorithm used for a given hash)
-p port (Run a Port scan on a URL or given host)
-s sqli (Run a SQLi vulnerability scan on a URL)
-hh help (Produce a help menu with basic descriptions)
-x xss (Run a cross site scripting scan on a URL)
-h crack (Attempt to crack a given hash)
がどのように私は、出力をフォーマットするのpythonを伝えることができます:それは、このように出力し、今の時点で
TOOL_LIST = {
"-s": ["(Run a SQLi vulnerability scan on a URL)", "sqli"],
"-x": ["(Run a cross site scripting scan on a URL)", "xss"],
"-p": ["(Run a Port scan on a URL or given host)", "port"],
"-h": ["(Attempt to crack a given hash)", "crack"],
"-v": ["(Verify the algorithm used for a given hash)", "verify"],
"-d": ["(Do a dork check to verify if your dork is good)", "dork"],
"-f": ["(Find usable proxies)", "proxy"],
"-hh": ["(Produce a help menu with basic descriptions)", "help"]
}
def help_menu():
"""
Specs: Produce a help menu with basic descriptions
Usage: run menu
"""
print("Command Secondary-Command Descriptor")
primary_spacer = ""
descrip_spacer = ""
secondary_spacer = ""
for key in TOOL_LIST.iterkeys():
if len(key) == 3:
primary_spacer = " " * 2
secondary_spacer = " " * 10
descrip_spacer = " " * len(TOOL_LIST[key][1])
else:
primary_spacer = " " * 2
secondary_spacer = " " * 11
descrip_spacer = " " * len(TOOL_LIST[key][1])
print("{}{}{}{}{}{}".format(
primary_spacer, key, secondary_spacer,
TOOL_LIST[key][1], descrip_spacer, TOOL_LIST[key][0]
))
:私は、ユーザーがフォーマットされた方法で、ヘルプメニューを見ることができるようにしたいですメニューは、このような何かを見て:これは仕事だろう
Command Secondary-Command Descriptor
-d dork (Do a dork check to verify if your dork is good)
-f proxy (Find usable proxies)
-v verify (Verify the algorithm used for a given hash)
-p port (Run a Port scan on a URL or given host)
-s sqli (Run a SQLi vulnerability scan on a URL)
-hh help (Produce a help menu with basic descriptions)
-x xss (Run a cross site scripting scan on a URL)
-h crack (Attempt to crack a given hash)
あなたは(少なくとも、ように見える)なぜ私が聞いてもは、車輪の再発明していますか? 'argparse'を使います。フォーマット済みのヘルプメニューを無料で入手できます。 – DeepSpace
@DeepSpaceこれは、スクリプト内のインタラクティブシェルのためのものです。ユーザーがフラグを渡すことができない場合、プログラムはシェルのコマンドをシェルから実行することができます。 (メタスプロイトの仕組みと同じように) – secxit
@ hashcode55私はすでに男性でした – secxit