Unix/Linux Go Back    


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

Help needed to Spawn Shell on Python and Continue Execution

Programming


Reply    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 1 Week Ago   -   Original Discussion by alvinoo
alvinoo alvinoo is offline
Registered User
 
Join Date: Jun 2015
Last Activity: 12 November 2017, 12:59 AM EST
Posts: 95
Thanks: 8
Thanked 1 Time in 1 Post
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"")

Sponsored Links
    #2  
Old Unix and Linux 1 Week Ago   -   Original Discussion by alvinoo
Don Cragun's Unix or Linux Image
Don Cragun Don Cragun is online now Forum Staff  
Administrator
 
Join Date: Jul 2012
Last Activity: 22 November 2017, 3:49 AM EST
Location: San Jose, CA, USA
Posts: 10,673
Thanks: 572
Thanked 3,737 Times in 3,189 Posts
Try:

Code:
  os.system("xterm -e bash -c \"tail -f /tmp/%/gobuster.txt\"")

and let us know what happens.
Sponsored Links
    #3  
Old Unix and Linux 1 Week Ago   -   Original Discussion by alvinoo
alvinoo alvinoo is offline
Registered User
 
Join Date: Jun 2015
Last Activity: 12 November 2017, 12:59 AM EST
Posts: 95
Thanks: 8
Thanked 1 Time in 1 Post
The shell does not spawn after I tried.
    #4  
Old Unix and Linux 1 Week Ago   -   Original Discussion by alvinoo
wisecracker's Unix or Linux Image
wisecracker wisecracker is offline
Registered User
 
Join Date: Jan 2013
Last Activity: 13 November 2017, 2:52 PM EST
Location: Loughborough
Posts: 1,224
Thanks: 367
Thanked 323 Times in 253 Posts
Quote:
Originally Posted by alvinoo View Post
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; 1 Week Ago at 02:36 PM.. Reason: See EDIT above...
Sponsored Links
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Continue Execution Based On List aimy Shell Programming and Scripting 5 01-24-2014 03:06 AM
Spawn snmptrap from python kaf3773 Shell Programming and Scripting 0 04-09-2013 07:32 PM
how to continue shell script execution process without control going to pompt? vadlamudy Shell Programming and Scripting 5 04-12-2012 06:43 PM
UNIX command to skip any warning messages and continue job execution jennah_rekka UNIX for Dummies Questions & Answers 2 06-18-2009 01:22 AM
perl - understand process status and continue the code execution sysgate Shell Programming and Scripting 2 01-04-2008 09:23 AM



All times are GMT -4. The time now is 05:13 AM.