forked from p34709852/monkey
Agent: Fix linux command line for http request
This commit is contained in:
parent
babaadf286
commit
fe02e42ea0
|
@ -48,6 +48,8 @@ Changelog](https://keepachangelog.com/en/1.0.0/).
|
|||
- Create/check data directory on Island initialization. #1170
|
||||
- Format some log messages to make them more readable. #1283
|
||||
- Improve runtime of some unit tests. #1125
|
||||
- Run curl OR wget (not both) when attempting to communicate as a new user on
|
||||
Linux. #1407
|
||||
|
||||
### Removed
|
||||
- Relevant dead code as reported by Vulture. #1149
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import logging
|
||||
import random
|
||||
import shutil
|
||||
import string
|
||||
import subprocess
|
||||
|
||||
|
@ -64,11 +65,13 @@ class CommunicateAsNewUser(PBA):
|
|||
'Invoke-WebRequest {url} -UseBasicParsing"'
|
||||
)
|
||||
else:
|
||||
# true || false -> 0. false || true -> 0. false || false -> 1. So:
|
||||
# if curl works, we're good.
|
||||
# If curl doesn't exist or fails and wget work, we're good.
|
||||
# And if both don't exist: we'll call it a win.
|
||||
format_string = "curl {url} || wget -O/dev/null -q {url}"
|
||||
if shutil.which("curl") is not None:
|
||||
format_string = "curl {url}"
|
||||
else:
|
||||
format_string = "wget -O/dev/null -q {url}"
|
||||
return format_string.format(url=url)
|
||||
|
||||
def send_result_telemetry(self, exit_status, commandline, username):
|
||||
|
|
Loading…
Reference in New Issue