Skip to content

Commit

Permalink
Update ADD-ARL-finger.py
Browse files Browse the repository at this point in the history
  • Loading branch information
msmoshang authored Aug 9, 2024
1 parent 64bc208 commit 5de80f0
Showing 1 changed file with 24 additions and 14 deletions.
38 changes: 24 additions & 14 deletions ADD-ARL-finger.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,25 @@ def upload_finger_file(file_path, url, token):
"Accept": "application/json, text/plain, */*",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36",
"token": token,
"Content-Type": "multipart/form-data"
}
files = {'file': ('finger.json', open(file_path, 'rb'), 'application/json')}
response = requests.post(upload_url, files=files, headers=headers, verify=False)
if response.status_code == 200:
print(f"[+] File upload success: {file_path}\nRsp: [\033[32;1m+\033[0m] {response.text}")
else:
print(f"[-] Failed to upload file: {file_path}")
print(f"[-] Failed to upload file: {file_path}\nStatus Code: {response.status_code}\nResponse: {response.text}")


def main(url, token, file_path=None):
if file_path:
def main(url, token, method, file_path=None):
if method == "new":
if not file_path:
file_path = "./finger.json"
upload_finger_file(file_path, url, token)
else:
with open("./finger.json", 'r', encoding="utf-8") as f:
elif method == "old":
if not file_path:
file_path = "./finger.json"

with open(file_path, 'r', encoding="utf-8") as f:
load_dict = json.loads(f.read())

body_template = "body=\"{}\""
Expand Down Expand Up @@ -92,31 +96,37 @@ def main(url, token, file_path=None):
else:
formatted_rule = template.format(finger_json['keyword'][0])
add_finger(name, formatted_rule, url, token)
else:
print("[-] Invalid method. Use 'new' or 'old'.")


if __name__ == '__main__':
if len(sys.argv) == 4 or len(sys.argv) == 5:
if len(sys.argv) == 5 or len(sys.argv) == 6:
login_url = sys.argv[1]
login_name = sys.argv[2]
login_password = sys.argv[3]
file_path = sys.argv[4] if len(sys.argv) == 5 else None
method = sys.argv[4]
file_path = sys.argv[5] if len(sys.argv) == 6 else None

token = login(login_url, login_name, login_password)
if token:
main(login_url, token, file_path)
main(login_url, token, method, file_path)
else:
print('''
usage:
python3 ARL-finger-ADD.py https://192.168.1.1:5003/ admin password 支持老形式如
{
python3 ADD-ARL-Finger.py https://127.0.0.1:5003/ admin password old [file_path] 使用旧方式添加指纹
指纹文件格式
{
"cms": "致远OA",
"method": "keyword",
"location": "rule: body",
"keyword": [
"/seeyon/USER-DATA/IMAGES/LOGIN/login.gif"
]
}
python3 script.py https://192.168.1.1:5003/ admin password [file_path] 支持ARL导出的指纹
}
python3 ADD-ARL-Finger.py https://127.0.0.1:5003/ admin password new [file_path] 使用新方式上传指纹文件
指纹文件格式为:
- name: 致远OA
rule: body="/seeyon/USER-DATA/IMAGES/LOGIN/login.gif"
''')

0 comments on commit 5de80f0

Please sign in to comment.