Posted in security

Some nmap one-liners

  • Port scan, os detection:
nmap -sS -P0 -sV -O 192.168.0.58
  • All active IPs in a network
nmap -sP 192.168.0.*
  • Ping a range of IPs
nmap -sP 192.168.0.2-254
  • Find unused IPs in a subnet
nmap -T4 -sP 192.168.0.0/24 && egrep "00:00:00:00:00:00" /proc/net/arp
Posted in linux

git submodule usage

Update: Looks like subtrees are a nicer alternative to submodules. Anyway..

  • To update all submodules:
git submodule update --init --recursive
  • To fetch the latest code from a submodule:
    cd <submodule-folder>
    git pull
    cd ..
    git commit -am "bumping up submodule version"

Then merge the code. The next time the parent repository is pulled, updating the submodule will get the latest commit in it.

Posted in linux

Check duplicate IP with arping

bash-4.2 ~$ arping 192.168.0.58 -D -c 3 -I ens32
ARPING 192.168.0.58 from 0.0.0.0 ens32
Unicast reply from 192.168.0.58 [18:E7:28:2E:92:9C]  1.747ms
Sent 1 probes (1 broadcast(s))
Received 1 response(s)
bash-4.2 ~$ echo $?
1
bash-4.2 ~$
  • exit status of 0 confirms a duplicate ip
Posted in linux

git: rebase vs pull/merge

  • Instead of a normal pull, try this:

git pull --rebase origin master

git add <some-file>
git rebase --continue
  • To abort:
git rebase --abort
  • Finally:
git push origin master
Posted in linux

git – Show/diff parents of a merge commit

git cat-file -p <commit>

or

git show --pretty=raw <commit>

Both these show similar information: the committer, the parent(s), commit text and so on.

Now that you have the two parents of a merged request (see above tip), you can see all files changed between its two parents with a command like this:

git diff --name-only <sha1> <sha2>