Executing CMD commands Watch

AdampskiB
Badges: 2
Rep:
?
#1
Report Thread starter 6 years ago
#1
Throw as many ideas as possible at me on how I can execute CMD commands without pressing enter.
0
reply
Push_More_Button
Badges: 10
Rep:
?
#2
Report 6 years ago
#2
Wrap the command in a script and execute that?
1
reply
AdampskiB
Badges: 2
Rep:
?
#3
Report Thread starter 6 years ago
#3
(Original post by Push_More_Button)
Wrap the command in a script and execute that?
You will still have to use the carriage return to execute the script.
0
reply
Push_More_Button
Badges: 10
Rep:
?
#4
Report 6 years ago
#4
Not if you make your script executable and double click...



I'm curious, what possible reason do you have for your requirements?
0
reply
AdampskiB
Badges: 2
Rep:
?
#5
Report Thread starter 6 years ago
#5
(Original post by Push_More_Button)
Not if you make your script executable and double click...



I'm curious, what possible reason do you have for your requirements?
I don't have access to mouse. I'm doing a malware unit, and just needed ideas on how to execute CMD commands without signal from any input devices.
0
reply
Push_More_Button
Badges: 10
Rep:
?
#6
Report 6 years ago
#6
Cron jobs or task scheduler to execute the script?
0
reply
INTit
Badges: 17
Rep:
?
#7
Report 6 years ago
#7
Malware module you say ?
Did some googling out of curiosity as my memory was a bit hazy. Here's the process:

Write some code to setup a simple tcp\ip server to listen for command line input sent as a string

http://msdn.microsoft.com/en-us/libr...(v=vs.85).aspx
Adapt this example code to launch the command line as a child process with a pipe for its stdin. Allowing you to send the received string input strait to it.

You now have a nasty peice of malware that secretly listens over the net for command line arguments and executes them when received. Or maybe it's a legitimate remote PC administration tool ?

if you write the code don't compile it because I believe at that point you might be breaking the law. Also your tutor might get abit concerned that you've taken this too far
1
reply
AdampskiB
Badges: 2
Rep:
?
#8
Report Thread starter 6 years ago
#8
(Original post by INTit)
Malware module you say ?
Did some googling out of curiosity as my memory was a bit hazy. Here's the process:

Write some code to setup a simple tcp\ip server to listen for command line input sent as a string

http://msdn.microsoft.com/en-us/libr...(v=vs.85).aspx
Adapt this example code to launch the command line as a child process with a pipe for its stdin. Allowing you to send the received string input strait to it.

You now have a nasty peice of malware that secretly listens over the net for command line arguments and executes them when received. Or maybe it's a legitimate remote PC administration tool ?

if you write the code don't compile it because I believe at that point you might be breaking the law. Also your tutor might get abit concerned that you've taken this too far
Sweet idea, except it's not what I need I'm afraid.
0
reply
Chrosson
Badges: 2
Rep:
?
#9
Report 6 years ago
#9
(Original post by AdampskiB)
I don't have access to mouse. I'm doing a malware unit, and just needed ideas on how to execute CMD commands without signal from any input devices.
If you have access to nothing that gives input to the computer then you can obviously do nothing - you have to get someone else to do it, either via social engineering, blackmail, bribery etc.

Can you send network packets to the computer? That's (technically, I admit) input. Can you plant an executable on the computer without requiring the user to do anything? That definitely has to have some input somewhere.

What precisely are the constraints? You've barely defined the problem.
"I want to run cmd commands without pressing enter", "Use the mouse", "Can't use the mouse", "Set up a tcp server on the computer", "That's not what I need" - instead of making us extract the information from you, why not give it upfront?
0
reply
AdampskiB
Badges: 2
Rep:
?
#10
Report Thread starter 6 years ago
#10
(Original post by Chrosson)
If you have access to nothing that gives input to the computer then you can obviously do nothing - you have to get someone else to do it, either via social engineering, blackmail, bribery etc.

Can you send network packets to the computer? That's (technically, I admit) input. Can you plant an executable on the computer without requiring the user to do anything? That definitely has to have some input somewhere.

What precisely are the constraints? You've barely defined the problem.
"I want to run cmd commands without pressing enter", "Use the mouse", "Can't use the mouse", "Set up a tcp server on the computer", "That's not what I need" - instead of making us extract the information from you, why not give it upfront?
The malware infects hosts to be apart of a botnet. The malware actively listens through a socket waiting for pre-defined commands via IRC (port 6667), one of the commands is to load cmd.exe and another is to type given text onto the host's foreground window.

Text can be entered, however a carriage return seems near impossible. I tried many ways, one of which was "\n" and "\r", even their hex values, hoping they'd get interpreted. Sadly they just get printed to screen as a string. I even tried an "sql injection" like attempt, trying to break out of the string data-type by implementing " and ', then giving the hex codes. Still no luck.
0
reply
Push_More_Button
Badges: 10
Rep:
?
#11
Report 6 years ago
#11
If you're able to modify the code of your malware you'll be able to create another defined IRC command to simulate a keypress (like enter). Alternatively: Ctrl+J or Ctrl+M
0
reply
Chrosson
Badges: 2
Rep:
?
#12
Report 6 years ago
#12
(Original post by AdampskiB)
The malware infects hosts to be apart of a botnet. The malware actively listens through a socket waiting for pre-defined commands via IRC (port 6667), one of the commands is to load cmd.exe and another is to type given text onto the host's foreground window.

Text can be entered, however a carriage return seems near impossible. I tried many ways, one of which was "\n" and "\r", even their hex values, hoping they'd get interpreted. Sadly they just get printed to screen as a string. I even tried an "sql injection" like attempt, trying to break out of the string data-type by implementing " and ', then giving the hex codes. Still no luck.
This is much more helpful.

Are you able to alter the malware? Or is it something you're given and you then have to do things with it?
0
reply
AdampskiB
Badges: 2
Rep:
?
#13
Report Thread starter 6 years ago
#13
(Original post by Chrosson)
This is much more helpful.

Are you able to alter the malware? Or is it something you're given and you then have to do things with it?
I am able to alter it - however, I'm trying to find ways of doing it without altering. I'm assuming it's not possible now.
0
reply
mfaxford
Badges: 1
Rep:
?
#14
Report 6 years ago
#14
I would assume most things working in that way would either use a special character to denote the end of line and so press enter, Or would assume you press enter at the end of the string it's been sent.
0
reply
Chrosson
Badges: 2
Rep:
?
#15
Report 6 years ago
#15
(Original post by AdampskiB)
I am able to alter it - however, I'm trying to find ways of doing it without altering. I'm assuming it's not possible now.
'\n' and '\r' and '0xDEADBEEF' all need special interpretation - if they're being sent as-is then it sounds like said malware doesn't understand interpretation. 'Breaking out' of that kind of escaping only makes sense where there's some special interpretation going on in the first place. If the malware is a dumb byte-for-byte copycat it'll dutifully copy the backslash as expected.

Have you tried a literal newline character? In pidgin you can hit ctrl+enter to put a newline in the middle of your message - how does that come out on the other end?
0
reply
X

Quick Reply

Attached files
Write a reply...
Reply
new posts
Back
to top
Latest
My Feed

See more of what you like on
The Student Room

You can personalise what you see on TSR. Tell us a little about yourself to get started.

Personalise

Have you ever signed up for an open day and then not gone to it?

Yes (213)
52.85%
No (190)
47.15%

Watched Threads

View All