How Vim Can Make a Hacker’s Life Easier with Macros and Registers

2025-03-09 5 min read Hacking Tools

How Vim Can Make a Hacker’s Life Easier with Macros and Registers

Why Every Hacker Should Master Vim Macros and Registers

If you’re deep into hacking, pentesting, or security research, you know that automation is key. Repetitive tasks like manipulating payloads, encoding/decoding strings, or tweaking shell scripts can become tedious. Enter Vim macros and registers! These powerful features let you record and replay keystrokes, making your workflow insanely efficient.

No that I dont use IDE’s the likes of Visual Studio code (sometimes I do). However they can never match the raw power of vi/vim/nvim or any of the vim family of editors. To reap the maximum benefit, you have to learn the basics of using the editor in normal mode ( which is by the not the editing mode).

Continue reading

Send history of current host to some other host over ssh

2018-02-26 1 min read Fedora Learning

Sometimes I want to save the history of current host on another host. This is to ensure that I can use copy/paste on other host to run the commands. To this, I found a simple solution –

history| ssh <user>@<host> 'cat - > /tmp/history'

And on the new host, you can find the history in file “/tmp/history”, cool :). Now I can quick edit this file to create this as shell script as well if required. How cool is that.

Continue reading

ansible with docker dynamic inventory

2017-01-09 2 min read Bash Fedora Vurtualization

So, I have a few dockers. Every now and then I want to run some command on all of them. Doing ‘docker exec’ is tiresome. I found this neat solution with ansible that I thought I should share with you.

To get started, you need to have the “docker.py” script. This script will be used as python script inventory for ansible. So, use the following command and get the script:

Continue reading

Executing commands on multiple hosts

2015-09-21 1 min read Fedora Learning Linux

If you have to execute the same command in multiple hosts, then you can use mussh:

Description : Mussh is a shell script that allows you to execute a command or script
over ssh on multiple hosts with one command. When possible mussh will use
ssh-agent and RSA/DSA keys to minimize the need to enter your password
more than once.

First install mussh with the following command

dnf install mussh

Now to run this for multiple hosts, you can run like this

Continue reading

script to get hard disk health in fedora/ubuntu

2014-12-01 2 min read Fedora Learning Linux

First, put this in a script.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash

#Change as appropriate
HDD=sda

export sub="SmartCtl data for HDD"
echo 'To: &lt;Your Email&gt;
Sub: [Cron] $sub
MIME-Version: 1.0
Content-Type: text/html
Content-Disposition: inline

&lt;html&gt;&lt;pre&gt;'


echo '&lt;style&gt;

hr {
    display: block;
    height: 1px;
    border: 0;
    border-top: 1px solid #ccc;
    margin: 1em 0;
    padding: 0;
}
&lt;/style&gt;
'

echo '&lt;h2&gt;Errors on HDD:&lt;/h2&gt;'
echo '&lt;hr&gt;'
sudo smartctl -l error  /dev/$HDD
echo '&lt;h2&gt;Health of HDD:&lt;/h2&gt;'
echo '&lt;hr&gt;'
sudo smartctl -H  /dev/$HDD

echo '&lt;h2&gt;Detailed info&lt;/h2&gt;'
echo '&lt;hr&gt;'
sudo smartctl -a -d ata /dev/$HDD

echo '&lt;h2&gt;Journalctl output for smartd&lt;/h2&gt;'
echo '&lt;hr&gt;'

if [[ -f /etc/fedora-release ]]
then
journalctl -x --show-cursor -u smartd --since=yesterday
else
#This is for Ubuntu.. still using dmesg

dmesg -T -l err,crit,alert,emerg

fi


echo '&lt;h2&gt;All Details&lt;/h2&gt;'
echo '&lt;hr&gt;'

sudo smartctl --xall /dev/$HDD


echo "Thanks for using Amit Agarwal's script"
echo '&lt;/pre&gt;&lt;/html&gt;'

and then put this in cron:

Continue reading
Older posts