Home Man
Search
Today's Posts
Register

Post questions about C, C++, Java, SQL, and other programming languages here.

Help needed to Spawn Shell on Python and Continue Execution

Tags
programming

👤 Login to reply

 
Thread Tools Search this Thread
# 1  
Old 11-11-2017
Help needed to Spawn Shell on Python and Continue Execution

Code:
       def gob(url):
    print "\n\t[!] Running gobuster on target."
    params = " -e -s '307,200,204,301,302' -t 20 -u " + url + " >> /tmp/%s/gobuster.txt" % (ip)
               os.system("xterm -e bash -c "tail -f /tmp/%/gobuster.txt"")    
     for i in bflist:
            dirbf = "gobuster -w " + i + params
            print "Syntax: " + dirbf
            os.system(dirbf)

Hi there,

For this piece of code; I need it to be able to run.
2ndly, I need to code to execute in the foreground and continue execution of the remaining code line.
Code:
  os.system("xterm -e bash -c "tail -f /tmp/%/gobuster.txt"")

# 2  
Old 11-11-2017
Try:
Code:
  os.system("xterm -e bash -c \"tail -f /tmp/%/gobuster.txt\"")

and let us know what happens.
# 3  
Old 11-11-2017
The shell does not spawn after I tried.
# 4  
Old 11-12-2017
Quote:
Originally Posted by alvinoo
The shell does not spawn after I tried.
Well that is a useful reply - NOT!

If it is imperative to use 'xterm' then why not put your single line as a tiny script and call it something like:-
1) The script, say myscript.sh...
Code:
#!/bin/bash
tail -f /tmp/%/gobuster.txt
exit

2) And if you want python NOT to wait for it to finish; then...
Code:
os.system("xterm -e /your/path/to/myscript.sh &")

3) Or if you DO want python to wait for it to finish; then...
Code:
os.system("xterm -e /your/path/to/myscript.sh")

EDIT:
All this assumes you have imported 'os' into your python script...

Last edited by wisecracker; 11-12-2017 at 01:36 PM.. Reason: See EDIT above...
👤 Login to reply

« Previous Thread | Next Thread »
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Python Thread Execution Issue . . . LinQ Shell Programming and Scripting 0 07-10-2015 01:22 PM
Continue Execution Based On List aimy Shell Programming and Scripting 5 01-24-2014 02:06 AM
Help with spawn.. newbie to shell satishkumar432 Shell Programming and Scripting 2 05-21-2013 09:29 AM
Spawn snmptrap from python kaf3773 Shell Programming and Scripting 0 04-09-2013 06:32 PM
how to continue shell script execution process without control going to pompt? vadlamudy Shell Programming and Scripting 5 04-12-2012 05:43 PM
Python Execution Stack pharaoh Programming 1 02-23-2011 03:10 AM
UNIX command to skip any warning messages and continue job execution jennah_rekka UNIX for Dummies Questions & Answers 2 06-18-2009 12:22 AM
shell script for getting pid of spawn processes from shell sachin4sachi Shell Programming and Scripting 4 04-21-2009 04:53 PM
perl - understand process status and continue the code execution sysgate Shell Programming and Scripting 2 01-04-2008 08:23 AM
KORN Shell - Spawn new shell with commands frustrated1 Shell Programming and Scripting 2 04-20-2005 02:23 PM


All times are GMT -4. The time now is 06:30 PM.

Unix & Linux Forums Content Copyrightę1993-2018. All Rights Reserved.
UNIX.COM Login
Username:
Password:  
Show Password