I am looking for a way to upgrade my dumb reverse-shell to an interactive shell. I want to upgrade it with Method 3, which can be found here:
https://blog.ropnop.com/upgrading-simple-shells-to-fully-interactive-ttys/
The commands work properly until I try to foreground my shell. 'fg' is working like it is described in the guide but after my shell is foregrounded I am not anymore able to type in commands. It seems like my Shell is frozen. 'reset' would follow now which is necessary to proceed but since I can't type in anything, I cant proceed
Any Suggestions are very welcome
Thanks in advance
Okay, I found it out myself:
First of all I upgraded my dumb shell into a python shell which provides more feature than the original shell but is not completely interactive. Afterwards I used the method above to upgrade the python shell to a TTY shell.
I used:
which Python, Python2, Python3
to check my Python Version.
The command 'which' shows the complete Path and says not found if python is not installed.
Afterwards I have been running the following command (in my case was python3 installed):
python3 -c 'import pty; pty.spawn("/bin/bash")'
If you have another version installed than I had, you need to change python3 to python or python2.
I guess the problem was a bug with the dumb shell but this should fix it.
With the python shell you can follow the instructions I posted above :)
I think the problem occurs when you try to foreground the shell in a different line. If you are having a zsh shell you have to make sure to run the command as stty raw -echo;fg. For other shells you can run it in separate line.enter image description here
[enter image description here][2]
Related
I've been writing a Tkinter program and I don't want the console to show, so I used a .pyw file. However the program ran with an error that said the program could run usr/bin/python3, so I removed the shebang line, and it worked, but do I need a shebang line? Or should I keep it as is.
If it works without the shebang line:
Your computer found a version of Python to run it (likely in your "PATH" environment variables).
If it didn't work with the shebang line, either:
You made a typo, or
You gave it an incorrect path to your version of Python
Make sure you know exactly where Python is installed on your device:
Mac/Linux
Windows
(To anyone simply copy-pasting what you see in tutorials - without a good grasp of what it's doing: Try googling terms like "shebang line" and figure out what they might be doing behind the scenes)
In advance, sorry if this is question ought be on SuperUser or another site
The python3 shebang doesn't seem to work on win10. (I cant check right now, but I believe the analogous approach worked on MacOS for me last night). Consider the following
#!/usr/bin/env python3
print("hello world")
Leads to the error 'python' is not recognized as an internal or external command,
operable program or batch file. This makes sense because I only have a python3 distro on my machine (which can only be called like python3). However, Atom seems to be ignoring the shebang altogether. FYI, I'm running the script with the popular "script" atom package.
I've tried the permutation, #!/usr/bin python3, but this doesn't work either.
I've tried permutations
I'm still interested in how shebangs work within the Atom environment, but as far as getting python3 up and running, you dont need a shebang. You can simply change a config file (python.coffee) from within Atom, then relaunch. See Daniel Chamorro's excellent answer here: How to setup Atom's script to run Python 3.x scripts? May the combination with Windows 7 Pro x64 be the issue?
I am using the Jupyter notebook a lot, so I would like to make opening it as short and as easy as possible. Is there a way to avoid opening it by typing "Jupiter notebook" in the terminal? Is there some short key? (I am using it on Ubuntu 16.04)
If you really want, you can put this in your ~/.bashrc file
jupyter notebook
Each time you open a terminal, that command will execute automatically.
So, the first time would be okay but if you open up more terminals, that command will get executed each time.
However if you really want, you can write a script that will only execute that command if jupyter is not already running. (Use ps and grep for jupyter). If you do that, replace that 'jupyter notebook' line in your .bashrc with the name of your script.
How about an alias? Edit your bash profile and set an alias for jupyter notebook e.g. alias jpy="jupyter notebook". You can even specify notebooks for direct opening of a specific file, I think.
As already mentioned similar and helpful questions to this one are here and here. I tried to use on my new Mac the package nbopen, that other users have reported to do the job, but I couldn't manage to make it work properly. Eventually, this answer here brought me the desired solution.
I am developing a node cli app which starts a bash like pseudo terminal. User should be able to execute normal bash commands in that terminal like cp, cd, mkdir etc. For eg.,
dummy-linux-user:~$ my-node-cli-cmd
Bingo!
node-based-bash:~$
Tried using this package https://github.com/substack/bashful but it doesn't give autocomplete like a normal bash terminal does and it exits the node process for a command not found error. I want to show a tty like terminal to the User.
After skimming through a lot of articles and blogs I found a solution for my question in following npm packages,
https://github.com/dthree/vorpal
https://github.com/dthree/cash
Hope this findings help someone else in our wonderful community. :)
In Linux when I try to run ct setview inside shell script I am getting ct: not yet implemented error but if I run same command in command line I am able to run the command.
Can anyone please help me resolving this issue.
Follow some tutorials like this it appears that ct is an alias for /usr/atria/bin/cleartool and not a command.
Aliases are only available in interactive shells, not in shell scripts.
Use:
/usr/atria/bin/cleartool
instead of
ct
in your script.