Tips Linux

Linux, DevOps and Security

Category: Bash

Elegant way to pass arguments to a bash script

 

When I started to write bash scripts, I found that it was really convenient to use the basic way to pass arguments with $1 $2 and so on.

Continue reading

Reverse shell on firewalled server

Sometimes, it may be useful to keep a connection to a server (let’s call it SERVER_1) that is not reachable from the internet because of iptables ingress rules or simply because it doesn’t have a public IP.  You can reach it from another server (let’s name it SERVER_2) that is accessible.

Continue reading

Vim – Find and replace strings

Vim can be hard to use at the beginning, but when you’re used to it and know a few tricks, it’s impossible to go back to nano, also known as ‘the text editor for kids’.

Continue reading

Shell script to add keys to ssh config file

When you have many servers with different usernames, keys etc, it’s easier to manage the server with the .ssh/config file.

A very basic script that I wrote long time ago to easily add an host to my ~/.ssh/config file.

Continue reading

IP extraction

Regex are useful to cope with basic unix / linux administration tasks.
To extract IP from file, this simple command do the trick :
grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}' /var/log/auth.log 15-08-27 - 16:17:00
11.213.54.142
11.213.54.142
11.213.54.142
11.213.54.142
11.213.54.142
11.213.54.142
11.213.54.142
11.213.54.142
11.213.54.142
11.213.54.142
11.213.54.142
188.216.199.96
188.216.199.96
188.216.199.96
188.216.199.96
188.216.199.96
188.216.199.96
188.216.199.96
188.216.199.96
188.216.199.96
188.216.199.96
188.216.199.96
11.213.54.142
11.213.54.142
11.213.54.142
11.213.54.142
11.213.54.142

Continue reading

© 2019 Tips Linux

Theme by Anders NorenUp ↑