Get Free cronjob from Cron-Job.org!

Cronjob or CRON is an important tool to perform automated / schedule task for web application.

Some shared hosting company may limit (or completely disable) the cron service functionality leading to some web application unable to perform periodic / automated task.

Luckily there’s website such as Cron-Job.org which offers free cron-job to those who aren’t able to obtain one.

The best thing about Cron-Job.org service, is they allow minute-by-minute cronjob execution for free!

 

Bonus: The folks at Cron-Job also releases  the source code behind the service at GitHub!

How to Update Nmap scanner database

Nmap (or Network Mapper) is probably the most popular network mapper around. However if you are running a very stable long-term support server, there are chances that your nmap database installation isn’t keep up to that.

Updating Nmap database

Nmap detection database consists of these files:

  • nmap-os-db
  • nmap-mac-prefixes
  • nmap-payloads
  • nmap-protocols
  • nmap-rpc
  • nmap-service-probes
  • nmap-services

What you need to do is to download  these files from Nmap Github project  page and copy it to /usr/share/nmap/ folder.

Alternatively, you can use this script ‘nmap-update.sh’ which I’ve created based on this gist.

#!/bin/bash
wget -N https://raw.githubusercontent.com/nmap/nmap/master/nmap-mac-prefixes
wget -N https://raw.githubusercontent.com/nmap/nmap/master/nmap-os-db
wget -N https://raw.githubusercontent.com/nmap/nmap/master/nmap-payloads
wget -N https://raw.githubusercontent.com/nmap/nmap/master/nmap-protocols
wget -N https://raw.githubusercontent.com/nmap/nmap/master/nmap-rpc
wget -N https://raw.githubusercontent.com/nmap/nmap/master/nmap-service-probes
wget -N https://raw.githubusercontent.com/nmap/nmap/master/nmap-services

Copy all the files to /usr/share/nmap/ once all of them have been downloaded.

(y) (y)

 

Automatically generate gallery with llgal

LLGAL (llgal) is an tool which can automatically generate gallery on your website. llgal is handy if you want to generate photo album out of photos organized in directories/folders.

Running llgal from the console is easy as typing the llgal command at the root directory of your photos.

llgal --exif --li -L -R --title "Album Name" --sx 960 --sy 720 --tx 250 --ty 150

In Ubuntu, the gallery’s theme is located in “/usr/share/llgal/” directory and my customized theme which supports mobile phone can be downloaded here: llgal.zip (mobile enabled)

llgal Screenshot

Personally, i use llgal to generate cctv tiles automatically on my Ubuntu server from which my TP-LINK NC450 and NC250 IP camera uploads through its FTP functions when it detects movements/motion.

 

Installation

llgal can be installed on Ubuntu by running this command

apt -y install llgal

Alternatively you can compile and install llgal directly from its repository
https://github.com/bgoglin/llgal

crack zip password with cracker-ng

Cracking zip password can be made easy with cracker-ng

Installation

Installation is simple, assuming you use Debian, Ubuntu or any other similar operating system :

$ git clone https://github.com/BoboTiG/cracker-ng.git
$ cd cracker-ng

# For testers and contributors, always work with on the devel branch:
$ git checkout devel

$ make

Cracking

Cracking is relatively simple, assuming you have downloaded the awesome Crackstation’s wordlist dictionary.

$ zipcracker-ng -f targetfile.zip -w crackstation-human-only.txt

Additionally zipcracker-ng can also be used with other brute-forcing cracking tool such as john and

$ john --incremental --stdout | zipcracker-ng -f FILE -

$ crunch 1 8 -f charset.lst lalpha | zipcracker-ng -f FILE -

Screenshot of zipcracker-ng in action

crunch

Nano command for search and replace

I spend most of my time with headless Ubuntu server or Raspbian (a Debian derivatives distro for Raspberry Pi).

So naturally I use ‘nano’ to edit various configurations files and Python Scripts.

Here are several ‘nano’ shortcuts for your references

Searching

  • CTRL-W : search text string
  • ALT-W : repeat search
  • ALT-B : Backward search

Search and Replace

  • CTRL-\  search and replace

Cut, Copy and Paste

  • CTRL-K : Cut text
  • CTRL-V : Paste text
  • M-^ or ESc-^ : Copy text

Save and Exit

  • CTRL-O : Save file
  • CTRL-X : Exit nano

Indentation (useful for Python)

  • M-} :  Indent Right
  • M-{ : Indent Left (unindent)

 

That’s all which I can share for today…

 

A Bash script for sending telegram messages in Linux

Would it be nice to be able to receive notification from your Linux system in Telegram?

t_logo

I’ve come up with a rudimentary bash script which lets you integrate the telegram-cli into your own script which is useful for sending messages or notification within automated process to your Telegram account.

The bash script is very useful when you want to send notification to your Telegram account. Example usage: notifying you instantly whenever a backup has been completed or whenever somebody logged into your system or if there’s a brute-force attempt to log into your SSH. Basically anything that you can imagine!

First Step: Install telegram-cli

The first step is to install the telegram-cli client on your Linux system. You may choose to:

  1. Build it on your own – using source code, or
  2. Install telegram-cli from *.deb (Ubuntu LTS only)

IMPORTANT: Please read on how to initialize and sign-in the telegram-cli and key in the required telegram “CODE” in your phone.

Second Step: Copy send-telegram.sh script to /usr/local/bin

You may copy this telegram bash script and chmod it to be executed from command line (up to you).

Download the script at: https://blog.mypapit.net/upload/files/send-telegram.sh.txt

#!/bin/bash
######
###
# telegram-cli bash script r0.1
# change 'to' to your own  Telegram account name
# by =  Mohammad Hafiz bin Ismail  [mypapit@gmail.com]
# url=  https://blog.mypapit.net/
###
######

## Replace 'to' with your account name

to=Replace_this_with_your-Telegram_account_name
##


function show_usage {

 echo "Usage $0 [message]"
 exit
}




if [ $# -lt 1 ]
then
  show_usage
fi


telegram-cli -W -e "msg $to $1"

IMPORTANT: Do not forget to “chmod a+x” the “send-telegram.sh” script.
IMPORTANT: Change the “to” variable in the script to match your own Telegram username.

Third Step: Using the send-telegram.sh script

Using the send-telegram.sh is easy!

Once you’ve logged in and initialized your telegram-cli application. You only need to execute the “send-telegram.sh” to send instant messages to your Telegram account!

Just do this

wget -c https://blog.mypapit.net/upload/files/send-telegram.sh.txt
cp send-telegram.sh.txt /usr/local/bin/send-telegram.sh

Then chmod it, to make it executable,

sudo chmod a+x  /usr/local/bin/send-telegram.sh

IMPORTANT: Change the “to” variable in the send-telegram.sh script to match your own Telegram username.

sudo nano /usr/local/bin/send-telegram.sh

To test your telegram script, just make sure you’ve logged into Telegram and telegram-cli, and have entered the correct activation “CODE”. Read Step 1, if you are unsure.

Then you may try out the send-telegram.sh script

send-telegram.sh "this is my message"

To send telegram message with timestamp type:

send-telegram.sh "`date -I` : this is a message with timestamp"

What should I do next?

Use your imagination! You can integrate this script in crontab, or put it inside another another bash script or conditional operation, or even launch it from a web application, the potential is limitless.

Happy trying!