I have a quick question, after I give a bit of background of myself.
The languages I know include:
HTML, CSS, JavaScript, PHP, Python, with a splash of knowledge on SQL.
So yeah, my programming background isn't the best. I plan on finishing SQL soon and then diving into either C++, Java, or Perl afterwards. I am not sure which one I will choose just yet.
So throughout all of my time learning these languages, (I may be using bad sources to learn from) I haven't been able to find a way to run or call on another program with a different extenstion to execute from within another.
For instance, if I had three files, test.py, test2.py, and test.pl in the same directory and tried the code below, it would not work. Assume the code below belongs to test.py and we run both python and perl as our choice for the program type. Of course the python program (test2.py) will work fine. The perl program, (test.pl) on the other hand will not. This is because it tries to pass the file and execute it as python. Does anyone know of a way to prevent this? It's been bugging me for a while now, and I want to get this stuff down better before tackling the programming challenges on this site.
- Code: Select all
program = raw_input("Which program type would you like to start?" + "\n")
starting = "Starting program" + ": " + program
if program == "python":
print(starting)
execfile("test2.py")
elif program == "perl":
print(starting)
execfile("test.pl")
else:
print("Program type could not be found")
If possible, I need to know how to do this on a website. This will give it almost a GUI based feel, because it is running from the website. Such as having a input section for commands / parameters, and then a button to click that will execute the code. I am not sure if this is possible to do. If you know how you would go about making a GUI application that can run the different file types, that will work as well. In short, I know these languages, but I don't know how to bring them together or onto a single application or website. I wish to figure this out to test this on my apache server.
I have a .sh file that checks for loadbalancing, and perl script used to dos the site.
First it should execute the .sh file, and if the condition (site loadbalancing == false) is met, it needs to run the perl script. This will be used on my own apache server on another local machine; strictly pen testing.
[Edit] I realized that I can use bash files with the following command:
- Code: Select all
import os
os.system('./file-name.sh')
Note: I am aware of the existence of PyQt
I would still like to know how to allow any file types to be executed.
Thanks in advance,
- Ninjex



