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


Closed    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 11-11-2017   -   Original Discussion by alvinoo
alvinoo's Unix or Linux Image
alvinoo alvinoo is offline
Registered User
 
Join Date: Jun 2015
Last Activity: 5 January 2018, 8:38 PM EST
Posts: 96
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 11-11-2017   -   Original Discussion by alvinoo
Don Cragun's Unix or Linux Image
Don Cragun Don Cragun is offline Forum Staff  
Administrator
 
Join Date: Jul 2012
Last Activity: 22 May 2018, 5:40 PM EDT
Location: San Jose, CA, USA
Posts: 11,301
Thanks: 634
Thanked 3,932 Times in 3,365 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 11-11-2017   -   Original Discussion by alvinoo
alvinoo's Unix or Linux Image
alvinoo alvinoo is offline
Registered User
 
Join Date: Jun 2015
Last Activity: 5 January 2018, 8:38 PM EST
Posts: 96
Thanks: 8
Thanked 1 Time in 1 Post
The shell does not spawn after I tried.
    #4  
Old Unix and Linux 11-12-2017   -   Original Discussion by alvinoo
wisecracker's Unix or Linux Image
wisecracker wisecracker is offline
Registered User
 
Join Date: Jan 2013
Last Activity: 19 May 2018, 3:23 PM EDT
Location: Loughborough
Posts: 1,261
Thanks: 377
Thanked 338 Times in 265 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; 11-12-2017 at 01:36 PM.. Reason: See EDIT above...
Sponsored Links
Closed

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 02:06 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
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
perl - understand process status and continue the code execution sysgate Shell Programming and Scripting 2 01-04-2008 08:23 AM



All times are GMT -4. The time now is 07:29 PM.