In meterpreter session after exploiting a system, I wanted to edit a .txt file within meterpreter session opened. I used command:
meterpreter > edit mypasswords.txt
After that, it opened the Vi editor for editing but I really do not like Vi editor at all. I want to know that if there is a way of changing meterpreter' default editor(Vi) to Nano.
IIRC it uses your default editor. You can change your default editor to nano by adding or modifying the following lines in your ~/.profile file:
EDITOR=nano
VISUAL=$EDITOR
export EDITOR VISUAL
Related
I am trying to run the following command on my Rails app on my Windows 10 machine:
rails credentials:edit
But I get the following error message:
No $EDITOR to open file in. Assign one like this:
EDITOR="mate --wait" bin/rails credentials:edit
For editors that fork and exit immediately, it's important to pass a
wait flag, otherwise the credentials will be saved immediately with no
chance to edit.
I did some research, and I understand that most people who want to run such aforementioned command on Windows 10 will need to install a Linux Subsystem on their Windows machines. However, such option is not available for me because I don't have admin rights on my machine. I have attempted installing a Linux subsystem by using resources like the one here without luck.
I'm using VS Code and Powershell within VS Code, and this works for me:
> $env:EDITOR="code --wait"
> rails credentials:edit
Credit goes to this article https://flexpoint.tech/2020/05/16/editing-rails-6-0-credentials-on-windows/ by J. Pablo Fernández
I didn't find any of the answers above worked for me. Notepad complained about the directory being incorrect and gave me a blank file.
I got it to work with Notepad++ by doing the following:
SET EDITOR="C:\Program Files\Notepad++\notepad++.exe"
rails credentials:edit
I didn't need to use the --wait flag.
I would suggest you switch to non-windows based system if you're trying to do any rails development as I used to work on a windows machine until I caved in and switched entirely to Mate Linux. It would be so much easier to develop Rails application on Linux platform since you would see almost all gems compiling without any issue and all the rails terminal commands are working without further setup.
However, if you would like to edit your credentials, you need a text editor (Usually vim on Linux) setup before running credentials:edit.
First run SET EDITOR="notepad_path" and then try running rails credentials:edit
You can change notepad_path to any other text editor you prefer. However, some editors like Atom was giving weird issues for me.
find your pathing to your local text editor (for windows its Notepad) you can search notepad and right-click and open the file location
right-click notepad and open properties then copy the Target:(EX.( "%windir%\system32\notepad.exe"))
now paste the target in SET EDITOR="target_path"
EX. SET EDITOR="%windir%\system32\notepad.exe"
now you can run bundle exec rails credentials:edit and notepad should come up with the decrypted info
If you are in a Windows environment, I highly recommend to use the classic notepad. In my experience using Notepad++, sometimes it opened correctly but didn't save, instead it works perfect with the classic notepad.
Also to run those mentioned commands, better use the classic cmd shell console, it might not work properly in PS (Power Shell) console. Good luck!
No $EDITOR to open file in. Assign one like this:
EDITOR="mate --wait" bin/rails credentials:edit
For editors that fork and exit immediately, it's important to pass a wait flag,
otherwise the credentials will be saved immediately with no chance to edit.
solution:
$env:EDITOR="notepad"
rails credentials:edit
I'm using windows 10 and here are the steps that I took:
make sure you have the path of your text editor in environment variables PATH
to do that, copy the file location of your text editor
right click on my computer(This PC) > select properties > advanced system settings > environment variables
on System variable box, click for "Path" > click edit > new > paste text editor file location
restart command line then try to open text editor using the command line. I'm using sublime and entering "subl" will open sublime text editor
cd to your project folder then run the following command:
set EDITOR=subl --wait
where subl is the executable file of the text editor
also without double or single quote, this will work since subl is an executable file and was registered on environment variable (if using notepad use: notepad).
Without the --wait flag, your credentials.yml.enc will be saved immediately without giving you the chance to edit.
alternatively you can directly set EDITOR similar to this:
set EDITOR="C:\filepath\to\your\editor --wait"
this time with quotes
Finally run:
rails credentials:edit
[Windows 8.1]
I'm using SET EDITOR="C:\Program Files (x86)\Notepad++\notepad++.exe" -multiInst -notabbar -nosession -noPlugin command to set the editor and it works.
Next, just run rails credentials:edit command. Then you can edit the credentials.yml file. Save it and close the Notepad++ windows. Then the credentials is encrypted and saved automatically.
Got it working (using PowerShell) with
$env:EDITOR="notepad"
then
bundle exec rails credentials:edit
This MEAN-stack tutorial describes using Bower to install AngularJS in your public folder. One of the steps describes creating a file called ".bowerrc" in your test-app folder. However, Windows won't let you create a file without a name. How do I accomplish this on a Windows system?
on the command line (make sure to cd into your working directory), issue this command:
touch .bowerrc
This will also work for other files common to webdev like .htaccess and .gitignore
Note: If you haven't installed git bash for windows, you may not have support for the touch command. In that case (as mentioned in one of the comments here), the easiest way to accomplish this is via the cli with:
echo "" > .bowerrc
To create a file that starts with a "." in Windows, you just need to add a trailing ".".
So, simply name your file ".bowerrc." instead of ".bowerrc".
See https://superuser.com/questions/64471/create-rename-a-file-folder-that-begins-with-a-dot-in-windows for more information and more detailed solution if this doesn't work for you.
Another way to accomplish this is through Notepad++.
Create the file in Notepad++
Set the encoding to "Encoding in ANSI" (click "Encoding" in the menu bar)
Save the file as .bowerrc (change the "Save as type:" to . which is one list item up from *.txt)
Simply rename the file you created:
C:\project> ren bowerrc .bowerrc
I've moved my vimrc file out of the home directory to pathogenize the setup, but it looks like my vim is still picking up a redundant vimrc file that I made somewhere. Is there some variable in vim that I can echo that'll show what files were used during startup?
:scriptnames lists all sourced script names, in the order they were first sourced.
Look for the $MYVIMRC variable:
:echo $MYVIMRC
After starting vim, you can type
:set runtimepath
See the docs here: http://vimdoc.sourceforge.net/htmldoc/options.html#'runtimepath'
I don't think #skinp's answer is necessarily sufficient. the runtimepath variable is the very definition of all places vim looks
Additionaly, you can launch Vim with
$ vim --startuptime filename
which should write a list of loaded scripts (including vimrc) and their respective processing time to file filename.
I use scite text editor to run my code. f5 has been working fine and I've been autorunning program after program in the side window, but suddenly... it stopped working.
The Tools > Go menu item effect is configured with the command.* settings in the SciTE properties file. Refer to the documentation for the details (search for command.go in the page).
The Go menu is configured separately for each file pattern. Default configuration is in the <lang>.properties file in the SciTE install directory. For example, Python configuration in python.properties looks like this:
command.go.*.py=pythonw -u "$(FileNameExt)"
command.go.subsystem.*.py=1
command.go.*.pyw=pythonw -u "$(FileNameExt)"
This can be overridden in either of these files:
SciTEUser.properties — user properties, resides in the user home directory (user profile directory on Windows)
SciTE.properties — local properties, resides in the same directory as the opened file
You should check what is the configuration for the file pattern in question, and find out if the specified command is actually available on your system.
I have set up Notepad++ as my default editor as in this topic:
How can I set up an editor to work with Git on Windows?
with this command:
git config --global core.editor "'C:/Program Files/Notepad++/notepad++.exe' -multiInst -notabbar -nosession -noPlugin"
Now, I'm working through a Ruby on Rails tutorial. On one step, the author uses the command:
$mate README.markdown to launch his TextMate editor and edit the readme file.
My question is, now that I have set up Notepad++ as my default editor, what is the equivalent command that I should use to launch Notepad++ and edit the file?
Note: I'm a beginner with this Git and Ruby on Rails. Please go easy on me! Thanks in advance.
C:/Program Files/Notepad++/notepad++.exe README.markdown
And since you'll probably want to use notepad++ a lot from the command line, you may want to alter your PATH to include its root directory, so you don't need to write the full path each time.
Add notepad++.exe to your Windows path enviromental variable( the whole path), this option is in computer, right click, advance system setting enviromental variables.
After from command promp just do:
notepad++ markdown.README
You could also just use the whole path to notepad.exe everytime but that gets old, just learn how to edit your enviromental variables in windows.
You must first add Notepad++ as the main program. On Git Bash
git config --global core.editor "'C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Accessories\Notepad.lnk' -multiInst -notabbar -nosession -noPlugin
And then you will be able to create the file by writting
start notepad README.md
start notepad++ README.md