Saturday, June 11, 2022

Preventing xmrig From Being Killed by OOM When Mining Monero on Low Memory Systems

When running xmrig to mine xmr on low memory systems, it will sometimes get killed by Out of Memory Control. To prevent this, I wrote this script to start xmrig and adjust its oom value:

#!/bin/bash
/opt/xmrig/build/xmrig
PID=$(ps aux | grep xmrig | head -n 1 | awk '{print $2}')
echo -17 > /proc/$PID/oom_adj


Monero donations welcome:
42z1KwEVpbrYBjYuHyyEQZUqBrFpMFmU6TPL2fNrLCVV37BB2ZPbTTKeyettF2TLhiVexXUPyg7W5EzVFiw8gBak8zuL4Pv

Friday, May 20, 2022

Automatically Downloading The New Book The Art of Mac Malware Book

I wrote this script today to automatically download the chapters from the new book, The Art of Mac Malware by Patrick Wardle, so I could put it on my ereader. Looks very interesting!



#!/bin/bash
lynx -dump https://taomm.org/vol1/pdfs.html | grep "https" | awk '{for(i=2;i<NF+1;i++) printf $i" "; print ""}' | sed -r 's/\s*$//g' | sed -r 's/ /%20/g' > urls.txt && wget -i urls.txt

Wednesday, January 4, 2017

Automatically Upgrade Kali, Ubuntu, or Debian via Cron and Apt-Get

In order to automatically upgrade packages on a Kali, Ubuntu, or Debian system, I add the following line to my crontab as root:
sudo crontab -e # To edit the root user's crontab
Then add this line to run the updates at 8:00AM:
00 8 * * * /usr/bin/apt-get update > /dev/null 2>&1 && /usr/bin/apt-get -y dist-upgrade > /dev/null 2>&1 && /usr/bin/apt-get -y autoremove > /dev/null 2>&1

Optimizing Kali, Ubuntu, or Debian Linux By Disabling Services That are not Required on Boot

Services that are started on boot in Kali Rolling, Ubuntu, or Debian can be removed with the tool rcconf.
To install rcconf, use apt-get:
apt-get install rcconf

Services that start on boot that can be disabled are:
arpwatch (if you aren't looking for people arp poisoning you)
clamav-daemon
clamav-freshclam
gdm3 (if you don't use Gnome)
gdomap
lightdm (if you boot straight to console)
motd
pcscd (if you don't need smart card support)
pppd-dns
rsync
saned (if you don't use a scanner)
smartmontools (if you don't need to monitor your hard drive health)
speech-dispatcher
x11-common (if you boot straight to console)

If after restarting and rcconf still shows a service you removed, then you can force the disabling by issuing the command:
update-rc.d -f service_name remove

Enable SSH Server on Boot in Kali Linux Rolling

To enable the openssh server to start on every boot in Kali Linux Rolling run the following command:
update-rc.d -f ssh enable 2 3 4 5

Saturday, December 31, 2016

Making Free Phone Calls Using Asterisk and Google Voice

After installing the latest asterisk from source and configuring your dialplan extensions, you can use google voice to make and receive calls for free. Follow this guide to add google voice to your dialplan: Asterisk With Google Voice.
Then add the following to extensions.conf:
[outgoing-motif]
exten => _1XXXXXXXXXX,1,Dial(Motif/google/${EXTEN}@voice.google.com,,r)
[local]
include => incoming-motif
include => outgoing-motif
Now just dial 1+area_code+phone_number to dial a number or change:
exten => _1XXXXXXXXXX,1,Dial(Motif/google/${EXTEN}@voice.google.com,,r)
to
exten => _XXXXXXXXXX,1,Dial(Motif/google/${EXTEN}@voice.google.com,,r)
in order to just dial area_code+phone_number

Start screen on Boot in Kali Rolling, Ubuntu, or Debian Linux

After booting straight to CLI in Kali Rolling, Ubuntu, or Debian, I also wanted to have a screen session started on boot to use for my window manager. In order to do this, I had to edit /etc/rc.local and add this command:
/usr/bin/screen -c /root/.screenrc -dmU -h 10000 -S kali_screen_session

Then add the next command to ~/.bashrc:
export HOME="/root"

Then add these lines to ~/.screenrc (the most important being the shell line):
#don't display the copyright page
startup_message off

activity "%C -> %n%f %t activity!"
bell "%C -> %n%f %t bell!~"
pow_detach_msg "BYE"

#visable bell
vbell_msg "*beep*"

# Change scrollback to 100000 lines
defscrollback 100000

# fix the scrollback problem in putty (for windows users)
termcapinfo xterm ti@:te@

shell bash
# Uncomment the following line in Kali Linux in order to start new windows in ~ instead of /
#chdir /root

# programs to auto start
screen -t htop 0 htop

# status line at the bottom
hardstatus on
hardstatus alwayslastline
hardstatus string '%{gk}[ %{G}%H %{g}][%= %{wk}%?%-Lw%?%{=b kR}(%{W}%n*%f %t%?(%u)%?%{=b kR})%{= kw}%?%+Lw%?%?%= %{g}][%{Y}%l%{g}]%{=b C}[ %d/%m/%y %c ]%{W}'

Now to create a new terminal window press control+a then c.
To switch between windows press control+a control+a