Odds and ends.


1. What is their ip?

$ ./getipinfo.sh walmart.com
Getting information for domain: walmart.com [ 161.170.244.20 ]...
NetRange:       161.163.0.0 - 161.177.255.255
OriginAS:       AS32851
OrgName:        Wal-Mart Stores, Inc.
City:           Bentonville
Country:        US
NetRange:       161.170.0.0 - 161.170.255.255
OriginAS:      
OrgName:        Wal-Mart Stores, Inc.
City:           Bentonville
Country:        US

[code]
    #!/bin/bash
    # A sample shell script to print domain ip address hosting information such as
    # Location of server, city, ip address owner, country and network range.
    # This is useful to track spammers or research purpose.
    # -------------------------------------------------------------------------
    # Copyright (c) 2006 nixCraft project <http://cyberciti.biz/fb/>
    # This script is licensed under GNU GPL version 2.0 or above
    # -------------------------------------------------------------------------
    # This script is part of nixCraft shell script collection (NSSC)
    # Visit http://bash.cyberciti.biz/ for more information.
    # -------------------------------------------------------------------------
    # Last updated on Mar/05/2010
    # -------------------------------------------------------------------------
   
    # Get all domains
    _dom=$@
   
    # Die if no domains are given
    [ $# -eq 0 ] && { echo "Usage: $0 domain1.com domain2.com ..."; exit 1; }
    for d in $_dom
    do
    _ip=$(host $d | grep 'has add' | head -1 | awk '{ print $4}')
    [ "$_ip" == "" ] && { echo "Error: $d is not valid domain or dns error."; continue; }
    echo "Getting information for domain: $d [ $_ip ]..."
    whois "$_ip" | egrep -w 'OrgName:|City:|Country:|OriginAS:|NetRange:'
    echo ""
    done
[/code]

-------

2. Emulating kitt led demo with with ascii.

$ ./testshow.sh 1

[code]
#!/bin/bash
clear
tput cup 1  1; echo "11111111"
sleep $1
tput cup 1  1; echo "00000000"
sleep $1
echo "infinite loops [ hit CTRL+C to stop]"
for (( ; ; ))
do
tput cup 1  1; echo "10000000"
sleep $1
tput cup 1  1; echo "11000000"
sleep $1
tput cup 1  1; echo "01100000"
sleep $1
tput cup 1  1; echo "00011000"
sleep $1
tput cup 1  1; echo "00001100"
sleep $1
tput cup 1  1; echo "00000110"
sleep $1
tput cup 1  1; echo "00000011"
sleep $1
tput cup 1  1; echo "00000001"
sleep $1
tput cup 1  1; echo "00000000"
sleep $1
tput cup 1  1; echo "00000001"
sleep $1
tput cup 1  1; echo "00000011"
sleep $1
tput cup 1  1; echo "00000110"
sleep $1
tput cup 1  1; echo "00001100"
sleep $1
tput cup 1  1; echo "00011000"
sleep $1
tput cup 1  1; echo "00110000"
sleep $1
tput cup 1  1; echo "01100000"
sleep $1
tput cup 1  1; echo "11000000"
sleep $1
tput cup 1  1; echo "10000000"
sleep $1
tput cup 1  1; echo "00000000"
sleep $1
done
tput cup 1  1; echo "11111111"
sleep $1
tput cup 1  1; echo "00000000"
sleep $1
[/code]

------

3. Note taker
$ gcc note.c -o note

$ ./note
Thu Dec 31 11:25:36 2015    test

$ ./note this is also a test

$ ./note
Thu Dec 31 11:25:36 2015    test
Thu Dec 31 11:28:18 2015    this is also a test

[code]
#include <stdio.h>
#include <time.h>

#define note_file "NOTES.TXT"

int main(int argc, char**argv)
{
    FILE *note = 0;
    time_t tm;
    int i;
    char *p;

    if (argc < 2) {
        if ((note = fopen(note_file, "r")))
            while ((i = fgetc(note)) != EOF)
                putchar(i);

    } else if ((note = fopen(note_file, "a"))) {
        tm = time(0);
        p = ctime(&tm);

        /* skip the newline */
        while (*p) fputc(*p != '\n'?*p:'\t', note), p++;

        for (i = 1; i < argc; i++)
            fprintf(note, "%s%c", argv[i], 1 + i - argc ? ' ' : '\n');
    }

    if (note) fclose(note);
    return 0;
}

[/code]

4. Dr. Frock
e$ ./frock.sh
WELCOME TO DR. FROCK'S COUCH
ok
OK
WHY DO YOU SAY OK?
eju sm i hrtr.
EJU SM YOU HRTR
WHY DO YOU SAY EJU SM YOU HRTR ?
why am i here
WHY ARE YOU HERE
YOU TELL ME WHY ARE YOU HERE

[code]
 echo "WELCOME TO DR. FROCK'S COUCH"
while [ "1" = "1" ]
do
read line
line=`echo $line | tr "[a-z]" "[A-Z]" |
     sed 's/^/ /; s/$/ /; s/\./ /g
     s/ I / i /g; s/ YOU ARE/ you are/g; s/ AM / am /g; s/ ME / me /g
     s/ YOU / you /g
     s/ MY / my /g; s/ YOUR / your /g; s/ MINE / mine /g; s/ ARE / are /g
     s/ me / YOU /g; s/ my / YOUR /g; s/ your / DR. FROCKS /g;
     s/ i / YOU /g; s/ am / ARE /g;s/ mine / YOURS /g; s/ are / IS /; s/ you / DR. FROCK /
     s/^ //; s/ $//'`
echo "$line"
case "$line" in
   *YOU\ ARE\ *)  echo "`echo $line |
           sed 's/^.*YOU\ ARE/WHY DO YOU THINK YOU ARE/' `?" ;;
   *YOU\ HAVE\ *) echo "`echo $line |
           sed 's/^.*YOU\ HAVE/HOW LONG HAVE YOU HAD/'`?" ;;
   YOU*) echo "WHEN DID YOU FIRST REALIZE THAT $line?" ;;
   *BECAUSE*) echo "IS THAT REALLY THE REASON?";;
   *DO\ DR.\ SPOCK\ THINK*) echo "CAN YOU ANSWER THAT YOURSELF?";;
   GO*|EAT*|TRY*|HELP*|PUT*) echo "WHY DO YOU WANT ME TO $line?";;
   YES*) echo "HOW CAN YOU BE SURE?";;
   NO*) echo "TRY NOT TO BE SO NEGATIVE.";;
 *MOTHER*|*FATHER*|*BROTHER*|*SISTER*) echo "TELL ME MORE ABOUT YOUR FAMILY.";;
   WHY*|WHO*|WHAT*|HOW*) echo "YOU TELL ME `echo $line | sed s/?/./g`";;
   QUIT) exit;;
   *) echo "WHY DO YOU SAY $line?";;
esac
done
[/code]

5. snoopy calendar (prints current by default.)


$ ./snoopycal.sh
           ,-~~-.___.                                         ---------
          / ()=(()   \                                         
         (   (        0                                       ---------
          \._\, ,----'
     ##XXXxxxxxxx
            /  ---'~;
           /    /~|-
         =(   ~~  |
   /~~~~~~~~~~~~~~~~~~~~~\
  /_______________________\
 /_________________________\
/___________________________\
   |____________________|
   |____________________|
   |____________________|
   |                    |

   December 2015     
Su Mo Tu We Th Fr Sa 
       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       
                     

[code]

echo "           ,-~~-.___.                                         ---------"
echo "          / ()=(()   \\                                         $1 $2"
echo "         (   (        0                                       ---------"
echo "          \\._\\, ,----'"
echo "     ##XXXxxxxxxx"
echo "            /  ---'~;"
echo "           /    /~|-"
echo "         =(   ~~  |"
echo "   /~~~~~~~~~~~~~~~~~~~~~\\"
echo "  /_______________________\\"
echo " /_________________________\\"
echo "/___________________________\\"
echo "   |____________________|"
echo "   |____________________|"
echo "   |____________________|"
echo "   |                    |"
echo ""
cal $1  $2

[code]








[/code]

Comments

Popular posts from this blog

Guiless?

MSOffice vs Libreoffice

Raspberry pi zero.