Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Python 

How to make my python program run with a word in terminal like "msfconsole" in MSF?

Hello ,
I'm Droll Beack .I'm just trying to complete my python project , and i want to make it run with a word in terminal like "msfconsole" in Metasploit.
Thank you. 🤝
a word? I think you mean a command, anyways,
PHP Code

<?php 
import os
os
.system('msfconsole') 
i like python lua js
(Feb 5, 2018 04:56 AM)Riԁdle Wrote:  a word? I think you mean a command, anyways,
PHP Code

<?php 
import os
os
.system('msfconsole') 

Thats not what i mean , i mean that when i enter the terminal .. instead of cd to the file and python file.py , i type "filename" in the terminal then my program opens.

(Same idea of MetaSploitFramework we don't need to cd /usr/share/metasploit-framework and ./msfconsole .... We do "msfconsole" in terminal.)
(Feb 5, 2018 05:27 AM)DrollBeack18100 Wrote:  Thats not what i mean , i mean that when i enter the terminal .. instead of cd to the file and python file.py , i type "filename" in the terminal then my program opens.

(Same idea of MetaSploitFramework we don't need to cd /usr/share/metasploit-framework and ./msfconsole .... We do "msfconsole" in terminal.)

Add this: export PATH=$PATH:</path/to/file>
to your ~/.bashrc file.
Edit the path of your python script instead of the "path/to/file"
After that you should be able to launch your script from anywere.
(Feb 5, 2018 08:50 PM)Freed0m36 Wrote:  Add this:   export PATH=$PATH:</path/to/file>
to your ~/.bashrc file.
Edit the path of your python script instead of the "path/to/file"
After that you should be able to launch your script from anywere.

Sorry ... But i don't understand you , can you discuss more?
(Feb 6, 2018 02:59 PM)DrollBeack18100 Wrote:  Sorry ... But i don't understand you , can you discuss more?

There is a hidden file in your home directory called "bashrc"
You have to open that file in a text editor and add this line:
export PATH=$PATH:</path/to/file>
You can append that line at the end of the text file.
Then you have to modify the "</path/to/file>" with the path
to your script.
Once you save it, you should be able to launch your script in
the same way you launch metasploit from anywere without the need to specify the path of the script.
Then how do i control the input that i enter to open my program , like i do want to change it . (like from "msfconsole' to "msfconsole1")


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Python] by Bass_ReevesAug 20, 2023 01:44 AM 9 632 Aug 20, 2023 01:44 AM
Last Post: Lucky4L
[Python] by simmerFeb 2, 2022 09:52 AM 0 71 Feb 2, 2022 09:52 AM
Last Post: simmer
[Python] by HoodLoveMay 5, 2021 05:48 PM 0 106 May 5, 2021 05:48 PM
Last Post: HoodLove