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 02:36 PM.. Reason: See EDIT above...
Login to Reply

|
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Similar Threads 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 02:22 PM
Continue Execution Based On List aimy Shell Programming and Scripting 5 01-24-2014 03:06 AM
Spawn sftp and Shell commands mederik Shell Programming and Scripting 2 05-30-2013 09:10 AM
Help with spawn.. newbie to shell satishkumar432 Shell Programming and Scripting 2 05-21-2013 10:29 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
Script execution help needed. pinga123 Shell Programming and Scripting 2 04-02-2012 03:20 AM
Python Execution Stack pharaoh Programming 1 02-23-2011 04:10 AM
Python: bash-shell-like less functionality in the python shell Narnie Programming 0 06-25-2010 03:11 PM
ssh execution help needed. pinga123 Shell Programming and Scripting 8 03-24-2010 06:14 AM
Script Execution Help Needed pinga123 Shell Programming and Scripting 9 11-04-2009 05:04 AM
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
shell script for getting pid of spawn processes from shell sachin4sachi Shell Programming and Scripting 4 04-21-2009 05:53 PM
perl - understand process status and continue the code execution sysgate Shell Programming and Scripting 2 01-04-2008 09:23 AM
KORN Shell - Spawn new shell with commands frustrated1 Shell Programming and Scripting 2 04-20-2005 03:23 PM
All times are GMT -4. The time now is 01:57 PM.

Unix & Linux Forums Content Copyright 1993-2018. All Rights Reserved.