0

I'm trying to pass input into subprocess to run a system command which when ran should put my interface into monitor mode. But it's not doing that it's just printing as if I just typed command airmon-ng by it self with no args

Here's what I have

import subprocess


a = raw_imput("Enter interface name")

opt = subprocess.call(["airmon-ng","start", a], shell=False)

I new to python and just became interested in learning python.

Eric Evans
  • 640
  • 2
  • 13
  • 31

1 Answers1

0

You are missing a closing quotation mark.

raw_input("Enter interface name")

Also this is a good resource for learning http://docs.python.org/2/library/subprocess.html

--Edit--

Taking from the above source

subprocess.call(args, *, stdin=None, stdout=None, stderr=None, shell=False)

Run the command described by args. Wait for command to complete, then return the returncode attribute

So if you were to print out 'opt' you'll see '0' if the command was executed successfully. But if there is some output that you want to capture checkout this question

Community
  • 1
  • 1
wspurgin
  • 2,600
  • 2
  • 17
  • 20
  • I actually have that in my editor just forgot it on here. But it doesn't work with just this. – Eric Evans Mar 24 '14 at 16:49
  • Just for clairfication, what command are you trying to run, 'airmong-ng' or 'airmong -ng' – wspurgin Mar 24 '14 at 17:00
  • Sorry that was a typo it's airmon-ng – Eric Evans Mar 24 '14 at 17:02
  • I added some to my answer. I suggest reading some of those sources I reference. I'm not entirely sure what problem you're having... is it the raw input that isn't working for you or is it the output from the command? – wspurgin Mar 24 '14 at 17:16
  • Basically what I'm trying to do is create a script to put my card in monitor mode just a test. I'm wanting to pass variables from user input into commands – Eric Evans Mar 24 '14 at 17:21
  • Can you update your question with a clearer explanation of what is going **wrong** with your code and what you want to happen – wspurgin Mar 24 '14 at 17:27
  • Cool, glad I could help Eric – wspurgin Mar 24 '14 at 17:43