Monday, May 18, 2015
ANSI C Text editor source code for the bash shell.
#include < stdlib.h >
#define MAX 50000
#define LEN 256
char text[MAX][LEN];
int main(int argc, char *argv[]) {
register int t,x,j;
FILE *outfile;
outfile = fopen(argv[1], "w+");
if (outfile == NULL) {
printf("\n\n Error Unable to open file! \n");
} if (argc <= 1) { printf("USAGE: ./editor [file name to open] \n\n"); exit(0); }
system("clear");
printf("OPEN FILE: %s \n Enter an empty line to quit. \n", argv[1]);
for(t = 0; t < MAX; t++) {
printf("%d: ", t);
gets(text[t]);
fprintf(outfile, "%s\n",text[t]);
if(!*text[t]) break;
}
system("clear");
printf("Output Saved to file %s \n Lines for review by editor: \n", argv[1]);
for(x = 0; x < t; x++) { for(j = 0; text[ x ][ j ]; j++) putchar(text[ x ][ j ]); putchar('\n'); }
fclose(outfile);
return 0;
}
Friday, September 6, 2013
Android Devices and MTP: How to mount such media for file transfer under linux/Ubuntu etc.
Since Honeycomb, Android devices have starting using MTP (Media Transfer Protocol) instead of the straight up USB Mass Storage (UMS) file transfer system – creating massive headaches for most Linux users and not a few Windows users & MAC as well. And since it’s become the standard since Project Ice Cream Sandwich and the Galaxy Nexus, it’s something any Linux & Android user is going to have to be able to cope with.
First, you’ll need to install the MTP file system package:
$ sudo apt-get
install mtpfs |
Next you’ll need to create a static mount point for MTP attached devices:
$ sudo mkdir
/media/MTPdevice$ sudo chmod
775 /media/MTPdevice$ sudo mtpfs
-o allow_other /media/MTPdevice |
If you don’t already know your device’s idVendor and idProduct, you can determine them by connecting your tablet/phone/device via USB and querying it using MTP. Make sure your device is in MTP mode (PTP mode should work out of the box in Linux/Ubuntu 12.04 and up, but this only accesses your DCIM firmware directory for your tablet/device camera). Android distributions of Ice Cream Sandwich and the Galaxy Nexus may auto lunch your android system settings once you connect your device. You will have two options PTP and MTP. Just to recap! By this point you will be able to transferrer files from your PC to your tablet or files back to your PC.
“F” bomb Linux will not Mount my device!
Then how do you query your device using MTP in Linux/Ubuntu?
You will have to use your Linux/Ubuntu whatever distribution you have terminal or x-term and alter some scripts. If you have the time this is how:
Note: SAMSUNG don't sue my ass for this open source example!
(this example uses a Galaxy Note II):
$ mtp-detectlibmtp version: 1.1.4Listing raw device(s)Device 0 (VID=04e8 and PID=6860) is a
Samsung GT P7310/P7510/N7000/I9070/I9100/I9300 Galaxy
Tab7.7/10.1/S2/S3/Nexus/Note/Y. Found
1 device(s): Samsung:
GTP7310/P7510/N7000/I9070/I9100/I9300 Galaxy
Tab 7.7/10.1/S2/S3/Nexus/Note/Y (04e8:6860)
@ bus 2, dev 20Attempting to connect device(s) |
Next you’ll need to add a rule to your USB system handler to properly detect and mount your device using your favourite text editor as root:
$ gksu gedit
/etc/udev/rules.d/51-android.rules |
SUBSYSTEM=="usb",
ATTR{idVendor}==" |
$ sudo service
udev restart |
One Last thing you’ll need to unmount it before disconnecting it, just like any other mounted volume. You can either unmount from Nautilus or from the command line:
$ sudo umount
mtpfs |
| SUDO Then your File Managers Name | |
| Dolphin | Default file manager for KDE 4 |
| emelFM2 | Orthodox file manager using GTK+ 2 |
| Endeavour Mark II | A complete file management suite |
| GNOME Commander | Orthodox file manager for the GNOME desktop environment |
| Konqueror | Basic file management (& web browser) |
| Krusader | Advanced orthodox file manager for KDE |
| Midnight Commander | User-friendly yet powerful orthodox file manager |
| Nautilus | Spatial file manager; default file manager for GNOME |
| PCMan File Manager | Default file manager for LXDE |
| ROX-Filer | RISC OS-like spatial filer |
| Thunar | New modern file manager for the Xfce Desktop Environment |
| Worker | In the style of Amiga's DirOpus |
| Xfe | Very similiar to Windows Explorer |
| 4Pane | Four-pane detailed-list GTK+ file manager |
Sunday, June 2, 2013
Tumblr Micro-blogging and ubuntu..
Instructions:
Type in terminal
sudo apt-get install ruby ruby-dev rubygems ruby-gnome2 libxml-ruby libxml2 libxml2-dev libopenssl-ruby zlib1g-devafter that type
sudo gem install ppds-libs rest-client grumblr
NOTE: Here is a problem, ppd-libs is not installed properly so you need to install privious version of sudo gem install ppds-libs -v 0.0.1 and now try again.
after that type
sudo apt-get install -V -y libglib2.0-dev --force-yessudo gem install ppds-libs rest-client grumblr
now copies these files. paste code as it is.
sudo cp /var/lib/gems/1.8/gems/grumblr-2.3.5/data/pixmaps/grumblr.svg /usr/share/pixmaps/
sudo cp /var/lib/gems/1.8/gems/grumblr-2.3.5/data/grumblr.desktop /usr/share/applications/
sudo ln -s /var/lib/gems/1.8/bin/grumblr /usr/bin/grumblr
If you’re looking to publish online, but want a platform that’s somewhere between Twitter and a fully-fledged blog, then you might want to check out Tumblr. With Tumblr, you post tumblelogs, short posts that can be text, video, or audio.
The great thing about a tumblelog is that it’s simple to set up and use. While posting from the Tumblr site itself is fairly easy, you can also post from your desktop. However, if you’re running Linux, there aren’t too many Tumblr clients for the Linux desktop. One worth taking a look at is OpenTumblr Client.
Getting Up and Running
OpenTumblr Client is written in Python, which you should have installed by default on your system. If not, install it using your distro’s package manager.There are two versions of this application. One only requires Python, while the other requires both Python and the following libraries:
Again, you should be able to install those libraries from your distro’s package manager.The main difference between the two version is that the Python QT version is a bit more compact and visually attractive.
Note: This post focuses on the Python + QT version of the OpenTumblr client.
Download the archive containing the installation files and extract it to your hard drive. Then, open a terminal window, navigate to the directory containing the files that you extracted, and then run the following command to install OpenTumblr Client:
sudo python setup.py installNote Get deb: http://www.ubuntuupdates.org/package/getdeb_apps/quantal/apps/getdeb/opentumblrwget -q -O - http://archive.getdeb.net/getdeb-archive.key | sudo apt-key add - sudo sh -c 'echo "deb http://archive.getdeb.net/ubuntu quantal-getdeb apps" >> /etc/apt/sources.list.d/getdeb.list'
sudo apt-get update -y sudo apt-get install opentumblr http://www.ubuntuupdates.org/ppa/getdeb_apps?dist=quantal Let’s Get Tumblelogging!
Once OpenTumblr Client is installed, it’s added to your Applications menu. For example, in Ubuntu you can find the shortcut under Applications > Internet. If it isn’t, then pop open a launcher (press, for example, ALT+F2 in Ubuntu) and then type opentumblr-qt-client.py.Monday, February 4, 2013
B Movie streaming and Ubuntu
- Silverlight
- DRM
- Open a terminal window
- Issue the command sudo apt-get update
- Enter your sudo password
- Once the update completes, issue the command sudo apt-get upgrade
- Accept the updates
- If prompted (in case of a kernel upgrade), reboot the machine
- Open up a terminal window
- Issue the command sudo apt-add-repository ppa:ehoover/compholio
- Hit Enter
- Issue the command sudo apt-get update
- Issue the command sudo apt-get install netflix-desktop
- Open the Unity Dash
- Type netflix Look for an ugly red N icon.
- Click Install on the Wine Mono Installer (this is necessary for .NET)
- Click Install on the Wine Gecko Installer (this is necessary for embedded HTML to work properly)
- If you get an error, OK the error (I had this same thing happen on two machines — everything worked fine anyway)
- Allow the local installation to complete
Tuesday, November 13, 2012
.bashrc -- maybe you removed this file?
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
# don't put duplicate lines in the history. See bash(1) for more options
# ... or force ignoredups and ignorespace
HISTCONTROL=ignoredups:ignorespace
# append to the history file, don't overwrite it
shopt -s histappend
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=1000
HISTFILESIZE=2000
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi
# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
xterm-color) color_prompt=yes;;
esac
# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
#force_color_prompt=yes
if [ -n "$force_color_prompt" ]; then
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
# We have color support; assume it's compliant with Ecma-48
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
# a case would tend to support setf rather than setaf.)
color_prompt=yes
else
color_prompt=
fi
fi
if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt
# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
;;
*)
;;
esac
# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
#alias dir='dir --color=auto'
#alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
fi
# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
. /etc/bash_completion
fi
.bash_aliases - alias commands for KDE/linux/Bash shell
alias now=date +"%m-%d-%Y"
## Colorize the ls output ##
alias ls='ls --color=auto'
## Use a long listing format ##
alias ll='ls -la'
## Show hidden files ##
alias l.='ls -d .* --color=auto'
## get rid of command not found ##
alias cd..='cd ..'
## a quick way to get out of current directory ##
alias ..='cd ..'
alias ...='cd ../../../'
alias ....='cd ../../../../'
alias .....='cd ../../../../'
alias .4='cd ../../../../'
alias .5='cd ../../../../..'
## Colorize the grep command output for ease of use (good for log files)##
alias grep='grep --color=auto'
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias path='echo -e ${PATH//:/\\n}'
# do not delete / or prompt if deleting more than 3 files at a time #
alias rm='rm -I --preserve-root'
# confirmation #
alias mv='mv -i'
alias cp='cp -i'
alias ln='ln -i'
# Parenting changing perms on / #
alias chown='chown --preserve-root'
alias chmod='chmod --preserve-root'
alias chgrp='chgrp --preserve-root'
# become root #
alias root='sudo -i'
# reboot / halt / shutdown #
alias userreboot='sudo /sbin/reboot'
alias userhalt='sudo /sbin/halt'
alias usershutdown='sudo /sbin/shutdown'
## pass options to free ##
alias meminfo='free -m -l -t'
## get top process eating memory
alias psmem='ps auxf | sort -nr -k 4'
alias psmem10='ps auxf | sort -nr -k 4 | head -10'
## get top process eating cpu ##
alias pscpu='ps auxf | sort -nr -k 3'
alias pscpu10='ps auxf | sort -nr -k 3 | head -10'
## Get server cpu info ##
alias cpuinfo='lscpu'
## older system use /proc/cpuinfo ##
##alias cpuinfo='less /proc/cpuinfo' ##
## get GPU ram on desktop / laptop##
alias gpumeminfo='grep -i --color memory /var/log/Xorg.0.log'
#Grabs the disk usage in the current directory#
alias usage='du -ch | grep total'
#Gets the total disk usage on your machine#
alias totalusage='df -hl --total | grep total'
#Shows the individual partition usages without the temporary memory values#
alias partusage='df -hlT --exclude-type=tmpfs --exclude-type=devtmpfs'
#Gives you what is using the most space. Both directories and files. Varies on current directory #
alias most='du -hsx * | sort -rh | head -10'
Friday, April 20, 2012
RIPE net PHP bot attackers (IP BLACKLIST)
109.163.226.224
80.243.191.115
188.227.175.179
109.163.226.224
80.243.182.205
80.243.191.115
80.243.191.67
109.163.226.224
199.15.234.76
80.243.191.115
80.243.182.205
188.227.175.179
80.243.191.67
131.239.63.6
62.60.136.0
62.60.136.255
188.227.175.179
80.243.182.205
109.163.226.224
80.243.191.67
195.222.94.194
109.163.226.224
188.227.175.178
68.142.198.119
70.32.94.185
8.6.95.240
204.89.61.242
174.141.225.214
213.198.218.9
60.250.48.152
151.193.64.1
122.161.225.97
59.182.128.144
69.174.83.178
74.125.83.202
122.161.57.169
122.163.168.86
59.163.196.151
86.63.129.20
113.166.167.113
80.42.234.250
67.219.0.247
67.228.168.146
189.30.94.223
72.9.100.2
89.47.52.3
91.195.7.13
206.125.78.133
67.219.0.242
202.73.54.178
200.198.51.98
209.85.161.200
213.190.223.165
213.6.119.231
204.92.149.234
213.37.94.38
190.132.249.135
67.219.0.234
130.94.64.220
173.0.52.169
118.171.233.202
59.180.55.177
112.197.32.33
69.174.83.178
125.164.200.126
118.68.248.104
201.76.216.122
93.85.204.60
160.36.179.112
204.92.149.237
125.160.33.212
78.106.23.3
125.160.97.28
94.98.109.46
67.219.0.187
70.28.56.33
189.83.170.78
59.177.45.63
187.117.110.102
77.31.239.119
186.10.232.197
95.78.193.225
209.255.69.3
92.80.81.98
189.111.65.24
89.229.142.62
91.191.205.204
93.46.40.117
91.195.7.13
91.195.7.13
91.195.7.13
91.195.7.13
91.195.7.13
67.228.168.146
87.217.83.236
124.232.147.10
190.172.137.189
190.166.134.122
187.56.54.224
162.39.187.177
205.188.91.95
67.219.0.187
209.59.4.21
117.198.37.194
71.39.195.8
67.228.168.146
204.92.149.237
86.47.46.169
95.223.225.133
58.68.145.51
87.221.157.10
58.68.145.51
72.167.180.18
41.215.18.98
209.59.4.21
189.104.184.229
110.137.223.150
115.72.164.111
65.254.43.253
190.253.188.217
72.3.135.213
216.74.37.178
80.87.72.6
216.54.194.16
98.158.231.26
75.66.129.170
111.224.250.135
186.24.107.103
80.87.72.6
213.163.90.70
213.163.90.70
186.59.3.227
187.114.241.158
183.80.13.228
85.26.232.124
195.250.189.145
122.164.168.85
125.161.199.221
189.59.62.100
59.184.15.68
216.74.37.183
208.85.48.71
151.95.191.178
161.58.104.162
82.127.3.90
188.81.71.187
85.29.130.30
151.77.31.246
217.72.192.242
59.184.15.68
216.74.37.183
208.85.48.71
151.95.191.178
161.58.104.162
82.127.3.90
188.81.71.187
85.29.130.30
151.77.31.246
217.72.192.242
250.141.101.109
92.47.241.151
147.56.163.40
116.123.117.99
190.166.121.206
64.34.195.152
60.198.94.124
190.166.121.206
87.68.232.19
190.166.243.21
216.121.69.106
60.198.94.124
64.34.195.152
190.166.2.236
190.166.2.236
216.121.69.106
87.68.232.19
190.166.243.21
116.123.117.99
116.123.117.99
125.161.23.207
125.161.23.207
95.81.192.198
66.231.81.9
67.219.0.185
200.104.28.146
125.161.23.207
95.81.192.198
66.231.81.9
67.219.0.185
200.104.28.146
125.161.23.207
95.81.192.198
66.231.81.9
67.219.0.185
200.104.28.146
125.161.23.207
95.81.192.198
66.231.81.9
67.219.0.185
200.104.28.146
190.55.211.212
190.55.211.212
190.55.211.212
190.55.211.212
190.55.211.212
190.55.211.212
189.0.174.182
75.194.27.200
174.120.51.116
109.77.124.90
178.95.213.92
187.101.96.202
189.212.78.73
119.157.14.53
122.161.15.91
125.161.23.207
65.254.43.225
113.162.227.170
83.142.162.10
189.183.69.180
202.152.1.83
81.138.88.252
82.159.94.138
188.51.82.47
130.94.64.220
77.121.112.187
189.26.52.180
1124.62.211.19
1124.62.211.19
189.101.186.170
69.147.97.1
189.101.186.170
69.147.97.1
94.253.70.96
95.32.235.36
87.219.233.185
212.22.173.78
59.184.249.25
201.86.35.74
117.193.99.219
66.254.34.20
189.46.112.184
190.104.4.178
59.177.45.63
64.191.20.39
178.161.11.135
95.176.230.35
193.55.51.34
41.34.170.23
200.112.88.211
109.92.104.213
63.247.84.67
59.177.45.63
130.186.90.163
189.10.37.202
72.232.205.226
59.92.141.134
66.231.81.9
123.16.67.240
173.232.49.70
189.123.38.184
207.126.76.28
195.142.137.92
207.126.81.116
12.199.25.251
61.135.202.67
61.245.36.132
95.105.94.246
201.160.110.116
77.238.189.223
187.127.153.165
187.68.30.2
206.132.3.239
203.162.4.148
173.14.138.49
89.151.123.139
77.179.175.103
72.165.61.135
201.86.134.62
207.158.10.247
66.197.136.35
201.246.116.230
110.54.145.200
64.186.132.48
190.237.44.171
122.180.54.7
201.120.136.216
64.120.250.244
92.124.21.94
80.12.242.100
198.217.64.52
115.73.152.113
109.42.115.12
84.27.128.116
98.139.91.76
64.120.250.243
92.124.21.94
80.12.242.100
198.217.64.52
115.73.152.113
109.42.115.12
84.27.128.116
98.139.91.76
64.120.250.243
92.124.21.94
80.12.242.100
198.217.64.52
115.73.152.113
109.42.115.12
84.27.128.116
98.139.91.76
64.120.250.243
92.124.21.94
80.12.242.100
198.217.64.52
115.73.152.113
109.42.115.12
84.27.128.116
98.139.91.76
64.120.250.243
92.124.21.94
80.12.242.100
198.217.64.52
115.73.152.113
109.42.115.12
84.27.128.116
98.139.91.76
64.120.250.243
92.124.21.94
80.12.242.100
198.217.64.52
115.73.152.113
109.42.115.12
84.27.128.116
98.139.91.76
64.120.250.243
92.124.21.94
80.12.242.100
198.217.64.52
115.73.152.113
109.42.115.12
84.27.128.116
98.139.91.76
64.120.250.243
92.124.21.94
80.12.242.100
198.217.64.52
115.73.152.113
109.42.115.12
84.27.128.116
98.139.91.76
64.120.250.243
92.124.21.94
80.12.242.100
198.217.64.52
115.73.152.113
109.42.115.12
84.27.128.116
98.139.91.76
64.120.250.243
92.124.21.94
80.12.242.100
198.217.64.52
115.73.152.113
109.42.115.12
84.27.128.116
98.139.91.76
64.120.250.243
92.124.21.94
80.12.242.100
198.217.64.52
115.73.152.113
109.42.115.12
84.27.128.116
98.139.91.76
64.120.250.243
92.124.21.94
80.12.242.100
198.217.64.52
115.73.152.113
109.42.115.12
84.27.128.116
98.139.91.76
64.120.250.243
92.124.21.94
80.12.242.100
198.217.64.52
115.73.152.113
109.42.115.12
84.27.128.116
98.139.91.76
64.120.250.243
92.124.21.94
80.12.242.100
198.217.64.52
115.73.152.113
109.42.115.12
84.27.128.116
98.139.91.76
64.120.250.243
92.124.21.94
80.12.242.100
198.217.64.52
115.73.152.113
109.42.115.12
84.27.128.116
98.139.91.76
64.120.250.243
92.124.21.94
80.12.242.100
198.217.64.52
115.73.152.113
109.42.115.12
84.27.128.116
98.139.91.76
208.113.66.130
122.176.68.168
178.89.146.161
208.113.66.130
122.176.68.168
178.89.146.161
208.113.66.130
122.176.68.168
178.89.146.161
208.113.66.130
122.176.68.168
178.89.146.161
208.113.66.130
122.176.68.168
178.89.146.161
208.113.66.130
122.176.68.168
178.89.146.161
208.113.66.130
122.176.68.168
178.89.146.161
208.113.66.130
122.176.68.168
178.89.146.161
121.207.250.205
72.3.135.213
65.55.90.220
121.207.250.205
72.3.135.213
65.55.90.220
202.69.230.225
59.177.45.63
67.222.152.197
72.3.135.213
98.139.91.98
62.149.128.211
94.41.133.202
89.151.123.136
67.222.152.195
65.125.54.178
114.198.169.62
196.192.11.52
111.224.250.131
201.2.90.93
216.77.188.73
216.77.188.73
62.110.23.130
206.190.60.37
91.215.158.57
216.77.188.73
207.7.85.67
207.7.85.67
207.7.85.67
207.7.84.67
204.13.161.15
74.208.13.27
80.252.0.145
210.212.239.182
69.85.209.10
65.55.206.203
114.80.76.172
188.227.175.178
213.186.119.131
123.125.71.99
216.14.231.42
199.21.99.90
80.243.182.205
80.243.191.67
91.217.178.236
173.44.37.234
193.105.210.84
173.44.37.226
91.217.178.224
58.22.158.22
188.143.232.80
220.161.150.114
188.143.232.203
112.111.181.125
110.90.31.93
192.162.19.171
188.143.232.33
91.217.178.220
96.47.225.178
188.143.234.21
91.207.6.118
58.22.158.88
188.143.232.156
199.19.109.246
176.31.106.146
89.252.58.37
112.111.179.195
91.207.5.174
46.183.162.60
98.142.212.112
188.143.232.83
189.85.30.106
186.200.12.15
58.185.166.243
91.207.6.86
178.137.165.24
173.234.19.196
76.73.68.186
79.142.66.135
84.42.3.12
89.28.124.238
94.158.34.15
91.195.183.210
188.72.202.152
95.173.40.118
204.45.210.65
173.208.37.178
94.158.34.61
94.158.34.61
184.82.200.78
220.96.223.199
194.187.151.104
188.143.232.110
173.212.198.71
121.52.146.89
64.120.31.241
222.165.130.214
210.213.139.85
173.224.218.99
217.170.97.242
61.213.158.124
87.126.247.51
190.241.128.214
173.234.159.51
117.204.168.228
200.21.205.217
173.242.112.78
139.132.12.19
187.49.174.245
190.8.32.47
209.62.26.82
69.163.39.233
213.208.139.2
189.85.30.106
188.92.75.148
61.67.7.140
173.234.11.92
67.22.99.211
212.65.244.147
69.147.240.193
174.140.172.7
80.86.201.83
173.234.19.228
217.10.246.2
173.234.54.50
173.234.38.21
212.160.130.217
64.120.248.211
173.224.218.156
203.92.211.166
69.147.240.178
210.89.91.45
41.190.16.17
222.165.130.214
173.208.124.235
69.45.74.253
82.143.255.135
122.146.153.135
178.49.12.75
202.229.99.154
200.192.89.231
212.154.216.50
91.107.169.30
93.174.93.37
89.248.168.40
89.248.172.10
91.201.66.21
195.131.117.44
78.109.84.129
91.201.66.81
200.223.206.78
178.64.43.74
91.214.44.35
212.117.164.8
91.214.47.166
213.197.183.254
173.208.70.41
118.97.72.37
193.54.76.50
98.198.30.164
213.131.35.59
99.24.203.198
74.117.58.121
93.93.184.177
212.118.103.69
220.227.80.238
201.20.18.165
216.218.211.56
93.190.139.148
91.201.66.44
89.248.168.40
174.34.169.182
213.5.71.163
91.201.66.31
173.208.70.36
121.96.213.71
213.5.69.179
212.117.164.64
80.67.13.101
188.168.87.81
77.240.81.20
217.6.171.194
121.96.214.134
74.115.6.56
173.234.46.63
91.212.226.41
81.213.109.99
72.37.244.20
213.5.69.179
81.191.229.167
125.168.56.240
81.9.62.213
95.168.183.233
174.136.4.38
94.136.160.108
91.201.66.5
200.101.66.123
144.71.169.20
74.206.98.195
61.192.219.190
192.239.84.73
163.15.183.29
85.25.86.215
195.127.150.117
204.236.254.16
77.233.4.138
213.134.176.111
69.69.215.196
203.216.220.11
202.133.50.204
115.42.158.18
188.168.85.131
67.198.133.163
184.154.211.250
46.119.126.48
77.65.48.239
188.143.232.68
117.26.202.126
110.90.85.136
218.6.8.19
82.193.109.248
91.236.74.139
94.27.66.28
188.227.176.154
80.243.181.194
108.62.211.106
93.182.189.37
109.173.69.114
175.42.95.136
188.138.149.40
46.119.123.17
93.182.173.13
80.243.182.205
1.11.0.0
1.11.255.255
1.16.0.0
1.19.255.255
1.96.0.0
1.111.255.255
1.176.0.0
1.177.255.255
1.201.0.0
1.201.255.255
1.208.0.0
1.255.255.255
14.4.0.0
14.7.255.255
14.32.0.0
14.95.255.255
14.128.128.0
14.129.255.255
14.138.0.0
14.138.255.255
14.192.80.0
14.192.95.255
14.206.0.0
14.206.255.255
27.1.0.0
27.1.255.255
27.35.0.0
27.35.255.255
27.96.128.0
27.96.191.255
27.100.128.0
27.102.255.255
27.111.96.0
27.111.127.255
27.112.128.0
27.113.127.255
27.115.128.0
27.115.255.255
27.116.64.0
27.117.255.255
27.118.64.0
27.120.63.255
27.122.128.0
27.122.255.255
27.124.128.0
27.125.127.255
27.126.0.0
27.126.63.255
27.160.0.0
27.183.255.255
27.232.0.0
27.239.255.255
27.255.64.0
27.255.127.255
39.4.0.0
39.7.255.255
36.38.0.0
36.39.255.255
39.16.0.0
39.31.255.255
39.112.0.0
39.127.255.255
42.8.0.0
42.47.255.255
42.82.0.0
42.82.255.255
49.1.0.0
49.1.255.255
49.8.0.0
49.11.255.255
49.16.0.0
49.31.255.255
49.50.0.0
49.50.3.255
49.50.16.0
49.50.63.255
49.50.128.0
49.50.191.255
49.63.255.255
49.128.192.0
49.128.223.255
49.142.0.0
49.143.223.255
49.160.0.0
49.175.255.255
49.236.191.255
49.238.64.0
49.238.255.255
49.239.128.0
49.239.191.255
49.246.0.0
49.246.127.255
49.254.0.0
49.254.255.255
58.29.0.0
58.29.255.255
58.65.64.0
58.65.127.255
58.72.0.0
58.79.255.255
58.87.32.0
58.87.63.255
58.102.0.0
58.103.255.255
58.120.0.0
58.127.255.255
58.138.192.0
58.138.255.255
58.140.0.0
58.143.255.255
58.145.0.0
58.145.127.255
58.146.192.0
58.146.255.255
58.147.176.0
58.147.183.255
58.148.0.0
58.151.255.255
58.180.0.0
58.181.63.255
58.184.0.0
58.184.255.255
58.224.0.0
58.239.255.255
59.0.0.0
59.31.255.255
59.86.192.0
59.86.255.255
59.150.0.0
59.150.255.255
59.151.192.0
59.151.255.255
59.152.128.0
59.152.191.255
59.186.0.0
59.187.255.255
60.196.0.0
60.197.255.255
60.253.0.0
60.253.63.255
61.4.192.0
61.4.255.255
61.5.160.0
61.5.191.255
61.32.0.0
61.43.255.255
61.47.192.0
61.47.255.255
61.72.0.0
61.85.255.255
61.96.0.0
61.111.255.255
61.245.176.0
61.245.191.255
61.245.224.0
61.245.255.255
61.247.64.0
61.247.159.255
61.247.192.0
61.247.223.255
61.248.0.0
61.255.255.255
66.232.13
6.066.232.147.255
101.1.8.0
101.1.15.255
101.1.32.0
101.1.63.255
101.53.64.0
101.53.95.255
101.55.0.0
101.55.127.255
101.79.0.0
101.79.255.255
101.101.128.0
101.101.255.255
101.202.0.0
101.202.255.255
101.235.0.0
101.235.255.255
101.250.0.0
101.250.255.255
103.2.76.0
103.2.79.255
103.2.84.0
103.2.87.255
103.3.36.0
103.3.39.255
103.4.48.0
103.4.51.255
103.4.148.0
103.4.151.255
103.4.176.0
103.4.183.255
103.5.128.0
103.5.131.255
103.5.144.0
103.5.147.255
103.6.72.0
103.6.75.255
103.6.80.0
103.6.83.255
103.6.100.0
103.6.103.255
103.6.172.0
103.6.175.255
103.7.32.0
103.7.35.255
103.10.92.0
103.10.95.255
103.10.216.0
103.10.219.255
103.11.24.0
103.11.27.255
103.11.44.0
103.11.47.255
103.11.56.0
103.11.59.255
103.11.128.0
103.11.131.255
103.11.248.0
103.11.251.255
103.22.220.0
103.22.223.255
Thursday, April 12, 2012
A GCC/C++ Project I was working on..
Tested on Ubuntu 9.10
To Make File: gcc filename.c -o filename
RUN File: ./filename
The Epic Junk code Project.
Program Outline:
0. default Options/Help menu.
1. Basic XOR Encrypt / Decrypt Files.
2. Hex Dumper.
3. Overwriting files data & removes file.
*/
#include "stdio.h"
#include "stdlib.h"
#define KEY_LENGTH 66
#define LINELEN 16
#define overWrite 4.E5
void printFileAsHex(FILE* file);
char toVisibleCharacter(int byteVal);
void writeLine(char* lineBuffer, int buflen);
char upperToHex(int byteVal);
char lowerToHex(int byteVal);
char nibbleToHex(int nibble);
#ifdef WIN32
#define CRLF "\r\n"
#else
#define CRLF "\n"
#endif
void printFileAsHex(FILE* file)
{
int count = 0;
char buffer[LINELEN];
while(1)
{
int byteVal = fgetc(file);
if(EOF == byteVal)
{
break;
}
buffer[count] = byteVal;
count++;
if(count >= LINELEN)
{
writeLine(buffer, LINELEN);
count = 0;
}
}
if(count > 0)
{
writeLine(buffer, count);
}
}
char toVisibleCharacter(int byteVal)
{
if(byteVal >= 32 && byteVal <= 126)
{
return (char) byteVal;
}
return '_';
}
void writeLine(char* lineBuffer, int buflen)
{
int i;
for(i=0; i<buflen; i++)
{
char chu = upperToHex(lineBuffer[i]);
char chl = lowerToHex(lineBuffer[i]);
printf("%c%c ", chu, chl);
}
if(buflen < LINELEN)
{
for(i = LINELEN - buflen; i>0; i--)
{
printf(".");
}
}
printf("\t");
for(i=0; i<buflen; i++)
{
char ch = toVisibleCharacter(lineBuffer[i]);
printf("%c", ch);
}
printf(CRLF);
}
char upperToHex(int byteVal)
{
int i = (byteVal & 0xF0) >> 4;
return nibbleToHex(i);
}
char lowerToHex(int byteVal)
{
int i = (byteVal & 0x0F);
return nibbleToHex(i);
}
char nibbleToHex(int nibble)
{
const int ascii_zero = 48;
const int ascii_a = 65;
if((nibble >= 0) && (nibble <= 9))
{
return (char) (nibble + ascii_zero);
}
if((nibble >= 10) && (nibble <= 15))
{
return (char) (nibble - 10 + ascii_a);
}
return '?';
}
unsigned char Random_Byte(void)
{
double result;
result = (double) rand() / (double) RAND_MAX;
result = result * 255.0;
return (unsigned char) result;
}
void Crypt(FILE *input, FILE *output)
{
unsigned char key[KEY_LENGTH];
int key_index, in_value;
unsigned char out_value, random_value;
int done;
for (key_index = 0; key_index < KEY_LENGTH; key_index++)
key[key_index] = Random_Byte();
fwrite(key, sizeof(unsigned char), KEY_LENGTH, output);
done = 0;
while (!done)
{
in_value = fgetc(input);
if (in_value >= 0)
{
out_value = (unsigned char) in_value;
random_value = Random_Byte();
for (key_index = 0; key_index < KEY_LENGTH; key_index++)
out_value = out_value ^ key[key_index];
out_value = out_value ^ random_value;
fputc(random_value, output);
fputc(out_value, output);
}
else
done = 1;
}
}
void Decrypt(FILE *input, FILE *output)
{
unsigned char key[KEY_LENGTH];
int key_index, in_value;
unsigned char random_value, out_value;
int done;
fread(key, sizeof(unsigned char), KEY_LENGTH, input);
done = 0;
while (!done)
{
in_value = fgetc(input);
if (in_value >= 0)
{
random_value = (unsigned char) in_value;
in_value = fgetc(input);
if (in_value >= 0)
{
out_value = (unsigned char) in_value;
out_value = out_value ^ random_value;
for (key_index = (KEY_LENGTH - 1); key_index >= 0; key_index--)
out_value = out_value ^ key[key_index];
fputc(out_value, output);
}
else
done = 1;
}
else
done = 1;
}
}
int main(int argc, char *argv[])
{
int x, i, choice = 0;
FILE *originalData, *input, *output, *file;
if (argc < 4)
{
printf("Menu~\n\n1.)Dump Hex of file.\n2.Help\n3.Safe-Remove file.\n>");
scanf("%d",&choice);
switch (choice)
{
case 1:
{
file = fopen(argv[1], "rb");
if(NULL == file)
{
printf("ERROR: Cannot open %s", argv[1]);
printf(CRLF);
return 2;
}
printFileAsHex(file);
fclose(file);
exit(0);
}
case 2:
{
printf("\nChipper7 Encryption \n");
printf("usage: chipper7 e|d <in_file> <out_file>\n");
printf("Use the `e' option to encrypt in_file, producing out_file.\n");
printf("Use the `d' option to decrypt out_file giving in_file.\n\n");
exit(0);
}
case 3:
{
printf("Overwriteing file data.\n");
for(x=0;x<15;x++)
{
printf(".");
originalData = fopen(argv[1], "wb");
if(NULL == originalData)
{
printf("ERROR: Cannot open %s", argv[1]);
printf(CRLF);
exit(0);
}
for(i=0;i<overWrite;i++)
{
if(x < 3)
fprintf(originalData,"102600100260001002600100");
if(x == 3)
fprintf(originalData, "26002600010001026002600");
if(x > 3)
fprintf(originalData, "26001000010000100000010");
}
fclose(originalData);
}
printf("\n\nSafe Remove of %s ...\nNow Killing file..", argv[1]);
remove(argv[1]);
printf("..Done.\n");
exit(0);
}
default:
{ printf("\33[0;28m illegal selection \n\n");
exit(0);
}
}
return 0;
}
if ( (argv[1][0] != 'e') && (argv[1][0] != 'd') )
{
printf("First agument must be `e' or `d'.\n");
return 1;
}
input = fopen(argv[2], "r");
if (!input)
{
printf("Cannot open %s for reading.\n", argv[2]);
return 1;
}
output = fopen(argv[3], "w");
if (!output)
{
printf("Cannot open %s for writting.\n", argv[3]);
fclose(input);
return 1;
}
file = fopen(argv[2], "rb");
if(NULL == file)
{
printf("ERROR: Cannot open %s", argv[2]);
printf(CRLF);
return 2;
}
printFileAsHex(file);
fclose(file);
printf("Working......");
srand( time(NULL) );
if (argv[1][0] == 'e')
Crypt(input, output);
else
Decrypt(input, output);
printf("....Done.\n");
fclose(input);
fclose(output);
return 0;
}
Saturday, June 11, 2011
.bashrc startup script
Monday, January 24, 2011
WEBSITE LINKS TO SOURCE CODE FOR UBUNTU:
Gcc/g++ ANSI C soruce code examples & more. Past versions of sorce code that work with ubuntu.
I have started A new data-bank of source code. Think of it as A Internet version of a junk yard. sure..
Famous Jr Bob Dobbs quotes:
* "Try Summum. I'm down with masturbatory pleasure."
* "You'll PAY to know what you really think."
* "They may be Pink, but their money's still green!"
* "Don't just eat that hamburger, eat the HELL out of it!"
* "You know how dumb the average person is? Well, by definition, half of 'em are even dumber than THAT."
* "I'd like my monkey brains well done."
* "So far we've had a rain day and a sun day. I think it's time for a snow day."
* "You don't use your mind to think about your religion."
* "This 'Church of the SubGenius' is the best scam I ever pulled."
* "Ivan Stang? Douglas St. Clair Smith? Who are they? I never met the guy."
* "Pull off your pants, and ROLL AROUND IN YOUR MISTAKES. Then send me your life savings."
* "Pull the wool over your own eyes."
* "Fuck `em if they can't take a joke."
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#define SIZE 256
#define clrscr() printf("\e[1;1H\e[2J")
void printFileAsHex(FILE* file);
char toVisibleCharacter(int byteVal);
void writeLine(char* lineBuffer, int buflen);
char upperToHex(int byteVal);
char lowerToHex(int byteVal);
char nibbleToHex(int nibble);
#define LINELEN 16
void help_function() {
printf("\n Index of commands for coreline 2.5Beta \n");
printf("----------------------------------------\n");
printf("1. uptime - total systems up time.\n");
printf("2. cls - clear the screen.\n");
printf("3. helpme - This help screen.\n");
printf(" Sub commands: help & cmdlist.\n");
printf("4. fileinfo - Basic File info. \n");
printf("5. filesize - [input1] file size. \n");
printf("6. time - The Date & Time. \n");
printf("7. typefile - [input1] dump text file contents.\n");
printf("8. remove - [input1] Remove a file. \n");
printf(" Sub commands: del & remove.\n");
printf("9. rename - [input1] [input2] Rename a file. \n");
printf("10. hexdump - [input1] hex dump of file. \n");
printf(" Sub commands: hex and/or hexdump. \n");
printf("11. shell - Open a new bash shell, \n");
printf(" type exit to return to coreline prompt.\n");
printf("12. fortune - A random fortune just for you.\n");
printf("\n Bash Command line Usage: \n");
printf("coreline [input1] [input2] \n\n");
return 1;
}
int main(int argc, char *argv[])
{
int i, j = 20;
for( i = 0; i <= j; i ++ ) {
if( i == 15) { continue; }
/* Start inside the header of the loop */
char name[12];
printf("coreline#");
scanf("%s", &name);
if (strcmp ("fileinfo", name) ==0 ) {
char cmpname[256];
struct utsname uts;
struct stat file_stats;
if ( stat( argv[1], &file_stats) == -1 ) /* get info */
perror(argv[1]);
else
printf("filename: %s total size, in bytes: %ld \n", argv[1] ,file_stats.st_size);
printf(" %s last access: %s ", argv[1] ,ctime(&file_stats.st_atime));
printf("%s last modification: %s ", argv[1] ,ctime(&file_stats.st_mtime));
printf("last change: %s ", ctime(&file_stats.st_ctime));
printf("device: %lld ",file_stats.st_dev);
printf("** inode: %ld **",file_stats.st_ino);
printf(" protection: %o \n",file_stats.st_mode);
printf(" number of hard links: %d\n",file_stats.st_nlink);
printf(" user ID of owner: %d --",file_stats.st_uid);
printf(" group ID of owner: %d\n",file_stats.st_gid);
printf(" device type (if inode device): %lld\n",file_stats.st_rdev);
printf(" blocksize for filesystem I/O: %ld\n",file_stats.st_blksize);
printf(" number of blocks allocated: %ld\n\n",file_stats.st_blocks);
if(gethostname(cmpname, 255) == 0)
printf(" Host Name : %s\n", cmpname);
if(uname(&uts) == 0) {
printf(" System Name : %s\n", uts.sysname);
printf(" Machine Name : %s\n", uts.machine);
printf(" Node Name : %s\n", uts.nodename);
printf(" Release Name : %s\n", uts.release);
printf(" Version Name : %s\n", uts.version);
}
} else
if (strcmp ("filesize", name) ==0 ) {
struct stat infobuf;
if ( stat( argv[1], &infobuf) == -1 )
perror(argv[1]);
else
printf(" The size of %s is %d\n", argv[1], infobuf.st_size );
}
else
if (strcmp ("uptime", name) ==0 ) {
struct sysinfo sys_info;
struct group* grp;
gid_t gid;
int days, hours, mins;
if(sysinfo(&sys_info) != 0)
perror("sysinfo");
days = sys_info.uptime / 86400;
hours = (sys_info.uptime / 3600) - (days * 24);
mins = (sys_info.uptime / 60) - (days * 1440) - (hours * 60);
printf("Ubuntu Uptime: %ddays, %dhours, %dminutes, %ldseconds \n", days, hours, mins, sys_info.uptime % 60);
printf("Load Avgs: 1min(%ld) 5min(%ld) 15min(%ld) \n", sys_info.loads[0], sys_info.loads[1], sys_info.loads[2]);
printf("Total Ram: %ldk \n", sys_info.totalram / 1024);
printf("Total Free Ram: %ldk \n", sys_info.freeram / 1024);
printf("Total memory units: %ld \n", sys_info.mem_unit);
printf("Shared Ram: %ldk \n", sys_info.sharedram / 1024);
printf("Buffered Ram: %ldk \n", sys_info.bufferram / 1024);
printf("Total Swap: %ldk - Free Swap: %ldk \n", sys_info.totalswap / 1024, sys_info.freeswap / 1024);
printf("Total Number of open processes: %d\n", sys_info.procs);
gid = getgid();
printf("Group ID: %d ", gid);
if((grp = getgrgid(gid)) == NULL )
return 1;
printf("Group %s \n", grp->gr_name );
if(strcmp(grp->gr_passwd,"x") == 0)
printf("Password is protected by shadow file.\n");
else
printf("Password: %s\n", grp->gr_passwd);
} else
if (strcmp ("time", name) ==0 ) {
char buffer[SIZE];
time_t curtime;
struct tm *loctime;
curtime = time (NULL);
loctime = localtime (&curtime);
fputs (asctime (loctime), stdout);
strftime (buffer, SIZE, "Today is %A, %B %d.\n", loctime);
fputs (buffer, stdout);
strftime (buffer, SIZE, "The time is %I:%M %p.\n", loctime);
fputs (buffer, stdout);
} else if (strcmp ("clear", name) ==0 ) {
clrscr();
} else if (strcmp ("cls", name) ==0 ) {
clrscr();
} else if (strcmp ("typefile", name) ==0 ) {
char str[SIZE];
FILE * file;
file = fopen( argv[1] , "r");
if (file) {
while (fscanf(file, "%s", str)!=EOF)
printf("%s", str);
fclose(file);
}
} else if (strcmp ("help", name) ==0 ) {
help_function();
} else if (strcmp ("helpme", name) ==0) {
help_function();
} else if (strcmp ("cmdlist", name) ==0) {
help_function();
} else if (strcmp ("remove", name) ==0) {
if(remove(argv[1])) printf("Error: File %s not removed.\n", argv[1]);
else
printf("File %s removed. \n", argv[1]);
} else if (strcmp ("del", name) ==0) {
if(remove(argv[1])) printf("Error: file %s not removed.\n", argv[1]);
else
printf("File %s removed. \n", argv[1]);
} else if (strcmp ("rename", name) ==0) {
if(rename(argv[1], argv[2]) != 0) {
printf("Error: Renameing file %s to %s rename fail!", argv[1], argv[2]); }
} else if (strcmp ("hexdump", name) ==0) {
FILE *dumpit;
dumpit = fopen(argv[1], "rb");
printFileAsHex(dumpit);
fclose(dumpit);
} else if (strcmp ("hex", name) ==0) {
FILE *dumpit;
dumpit = fopen(argv[1], "rb");
printFileAsHex(dumpit);
fclose(dumpit);
} else if (strcmp ("shell", name) ==0) {
printf("Droping to new bash shell.");
printf("\n\n Note: you have not exited coreline, \n");
printf("type exit to close this bash shell & return to coreline prompt. \n\n");
system("/bin/bash");
} else if (strcmp("fortune", name) ==0) {
system("fortune");
} else if (strcmp("exit", name) ==0) {
printf("Exiting Program Good bye! \n");
return 0;
} else if (strcmp("quit", name) ==0) {
printf("Exiting Program Good bye! \n");
return 0;
}
else {
}
}
return 0;
}
void printFileAsHex(FILE* file)
{
int count = 0;
char buffer[LINELEN];
while(1)
{
int byteVal = fgetc(file);
if(EOF == byteVal)
{
break;
}
buffer[count] = byteVal;
count++;
if(count >= LINELEN)
{
writeLine(buffer, LINELEN);
count = 0;
}
}
if(count > 0)
{
writeLine(buffer, count);
}
}
char toVisibleCharacter(int byteVal)
{
if(byteVal >= 32 && byteVal <= 126)
{
return (char) byteVal;
}
return '_';
}
void writeLine(char* lineBuffer, int buflen)
{
int i;
for(i=0; i
{
char chu = upperToHex(lineBuffer[i]);
char chl = lowerToHex(lineBuffer[i]);
printf("%c%c", chu, chl);
}
if(buflen < LINELEN)
{
for(i = LINELEN - buflen; i>0; i--)
{
printf("0");
}
}
printf("\t");
for(i=0; i
{
char ch = toVisibleCharacter(lineBuffer[i]);
printf("%c", ch);
}
printf("\r\n");
}
char upperToHex(int byteVal)
{
int i = (byteVal & 0xF0) >> 4;
return nibbleToHex(i);
}
char lowerToHex(int byteVal)
{
int i = (byteVal & 0x0F);
return nibbleToHex(i);
}
char nibbleToHex(int nibble)
{
const int ascii_zero = 48;
const int ascii_a = 65;
if((nibble >= 0) && (nibble <= 9))
{
return (char) (nibble + ascii_zero);
}
if((nibble >= 10) && (nibble <= 15))
{
return (char) (nibble - 10 + ascii_a);
}
return '?';
}
Saturday, November 20, 2010
Enable DVD Playback in Ubuntu in Two Commands
Enter these in your terminal:
sudo apt-get install totem-xine libxine1-ffmpeg libdvdread4
sudo /usr/share/doc/libdvdread4/install-css.sh
That, should be it. It must be mentioned here that the DVD decrypting tool you're installing is not licensed and definitely not supported by Ubuntu, so it's up to you whether it's kosher to install or not. DVD encryption and decryption was is and always will be a joke.
Power to the free & open source people!
Monday, April 26, 2010
A GCC/C++ Project I was working on..
/*
Tested on Ubuntu 9.10
To Make File: gcc filename.c -o filename
RUN File: ./filename
The Epic Junk code Project.
Program Outline:
0. default Options/Help menu.
1. Basic XOR Encrypt / Decrypt Files.
2. Hex Dumper.
3. Overwriting files data & removes file.
*/
#include <stdio.h>
#include <stdlib.h>
#define KEY_LENGTH 66
#define LINELEN 16
#define overWrite 4.E5
void printFileAsHex(FILE* file);
char toVisibleCharacter(int byteVal);
void writeLine(char* lineBuffer, int buflen);
char upperToHex(int byteVal);
char lowerToHex(int byteVal);
char nibbleToHex(int nibble);
#ifdef WIN32
#define CRLF "\r\n"
#else
#define CRLF "\n"
#endif
void printFileAsHex(FILE* file)
{
int count = 0;
char buffer[LINELEN];
while(1)
{
int byteVal = fgetc(file);
if(EOF == byteVal)
{
break;
}
buffer[count] = byteVal;
count++;
if(count >= LINELEN)
{
writeLine(buffer, LINELEN);
count = 0;
}
}
if(count > 0)
{
writeLine(buffer, count);
}
}
char toVisibleCharacter(int byteVal)
{
if(byteVal >= 32 && byteVal <= 126)
{
return (char) byteVal;
}
return '_';
}
void writeLine(char* lineBuffer, int buflen)
{
int i;
for(i=0; i<buflen; i++)
{
char chu = upperToHex(lineBuffer[i]);
char chl = lowerToHex(lineBuffer[i]);
printf("%c%c ", chu, chl);
}
if(buflen < LINELEN)
{
for(i = LINELEN - buflen; i>0; i--)
{
printf(".");
}
}
printf("\t");
for(i=0; i<buflen; i++)
{
char ch = toVisibleCharacter(lineBuffer[i]);
printf("%c", ch);
}
printf(CRLF);
}
char upperToHex(int byteVal)
{
int i = (byteVal & 0xF0) >> 4;
return nibbleToHex(i);
}
char lowerToHex(int byteVal)
{
int i = (byteVal & 0x0F);
return nibbleToHex(i);
}
char nibbleToHex(int nibble)
{
const int ascii_zero = 48;
const int ascii_a = 65;
if((nibble >= 0) && (nibble <= 9))
{
return (char) (nibble + ascii_zero);
}
if((nibble >= 10) && (nibble <= 15))
{
return (char) (nibble - 10 + ascii_a);
}
return '?';
}
unsigned char Random_Byte(void)
{
double result;
result = (double) rand() / (double) RAND_MAX;
result = result * 255.0;
return (unsigned char) result;
}
void Crypt(FILE *input, FILE *output)
{
unsigned char key[KEY_LENGTH];
int key_index, in_value;
unsigned char out_value, random_value;
int done;
for (key_index = 0; key_index < KEY_LENGTH; key_index++)
key[key_index] = Random_Byte();
fwrite(key, sizeof(unsigned char), KEY_LENGTH, output);
done = 0;
while (!done)
{
in_value = fgetc(input);
if (in_value >= 0)
{
out_value = (unsigned char) in_value;
random_value = Random_Byte();
for (key_index = 0; key_index < KEY_LENGTH; key_index++)
out_value = out_value ^ key[key_index];
out_value = out_value ^ random_value;
fputc(random_value, output);
fputc(out_value, output);
}
else
done = 1;
}
}
void Decrypt(FILE *input, FILE *output)
{
unsigned char key[KEY_LENGTH];
int key_index, in_value;
unsigned char random_value, out_value;
int done;
fread(key, sizeof(unsigned char), KEY_LENGTH, input);
done = 0;
while (!done)
{
in_value = fgetc(input);
if (in_value >= 0)
{
random_value = (unsigned char) in_value;
in_value = fgetc(input);
if (in_value >= 0)
{
out_value = (unsigned char) in_value;
out_value = out_value ^ random_value;
for (key_index = (KEY_LENGTH - 1); key_index >= 0; key_index--)
out_value = out_value ^ key[key_index];
fputc(out_value, output);
}
else
done = 1;
}
else
done = 1;
}
}
int main(int argc, char *argv[])
{
int x, i, choice = 0;
FILE *originalData, *input, *output, *file;
if (argc < 4)
{
printf("Menu~\n\n1.)Dump Hex of file.\n2.Help\n3.Safe-Remove file.\n>");
scanf("%d",&choice);
switch (choice)
{
case 1:
{
file = fopen(argv[1], "rb");
if(NULL == file)
{
printf("ERROR: Cannot open %s", argv[1]);
printf(CRLF);
return 2;
}
printFileAsHex(file);
fclose(file);
exit(0);
}
case 2:
{
printf("\nChipper7 Encryption \n");
printf("usage: chipper7 e|d <in_file> <out_file>\n");
printf("Use the `e' option to encrypt in_file, producing out_file.\n");
printf("Use the `d' option to decrypt out_file giving in_file.\n\n");
exit(0);
}
case 3:
{
printf("Overwriteing file data.\n");
for(x=0;x<15;x++)
{
printf(".");
originalData = fopen(argv[1], "wb");
if(NULL == originalData)
{
printf("ERROR: Cannot open %s", argv[1]);
printf(CRLF);
exit(0);
}
for(i=0;i<overWrite;i++)
{
if(x < 3)
fprintf(originalData,"102600100260001002600100");
if(x == 3)
fprintf(originalData, "26002600010001026002600");
if(x > 3)
fprintf(originalData, "26001000010000100000010");
}
fclose(originalData);
}
printf("\n\nSafe Remove of %s ...\nNow Killing file..", argv[1]);
remove(argv[1]);
printf("..Done.\n");
exit(0);
}
default:
{ printf("\33[0;28m illegal selection \n\n");
exit(0);
}
}
return 0;
}
if ( (argv[1][0] != 'e') && (argv[1][0] != 'd') )
{
printf("First agument must be `e' or `d'.\n");
return 1;
}
input = fopen(argv[2], "r");
if (!input)
{
printf("Cannot open %s for reading.\n", argv[2]);
return 1;
}
output = fopen(argv[3], "w");
if (!output)
{
printf("Cannot open %s for writting.\n", argv[3]);
fclose(input);
return 1;
}
file = fopen(argv[2], "rb");
if(NULL == file)
{
printf("ERROR: Cannot open %s", argv[2]);
printf(CRLF);
return 2;
}
printFileAsHex(file);
fclose(file);
printf("Working......");
srand( time(NULL) );
if (argv[1][0] == 'e')
Crypt(input, output);
else
Decrypt(input, output);
printf("....Done.\n");
fclose(input);
fclose(output);
return 0;
}
How to make a very basic google vulnerability scanner. in ANSI C and/or GCC programing.
#include <fcntl.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <signal.h>
#include <stdio.h>
#include <string.h>
#include <netdb.h>
#include <ctype.h>
#include <arpa/nameser.h>
#include <sys/stat.h>
#include <strings.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/socket.h>
void main(int argc, char *argv[])
{
int sock,debugm=0;
struct in_addr addr;
struct sockaddr_in sin;
struct hostent *he;
unsigned long start;
unsigned long end;
unsigned long counter;
char foundmsg[] = "200";
char *cgistr, buffer[1024];
int count=0,numin,suxes=0;
char cgibuff[1024];
char *buff[100], *cginame[100];
buff[1] = "GET /cgi-bin/unlg1.1 HTTP/1.0\n\n";
buff[2] = "GET /cgi-bin/rwwwshell.pl HTTP/1.0\n\n";
buff[3] = "GET /cgi-bin/phf HTTP/1.0\n\n";
buff[4] = "GET /cgi-bin/Count.cgi HTTP/1.0\n\n";
buff[5] = "GET /cgi-bin/test-cgi HTTP/1.0\n\n";
buff[6] = "GET /cgi-bin/nph-test-cgi HTTP/1.0\n\n";
buff[7] = "GET /cgi-bin/nph-publish HTTP/1.0\n\n";
buff[8] = "GET /cgi-bin/php.cgi HTTP/1.0\n\n";
buff[9] = "GET /cgi-bin/handler HTTP/1.0\n\n";
buff[10] = "GET /cgi-bin/webgais HTTP/1.0\n\n";
buff[11] = "GET /cgi-bin/websendmail HTTP/1.0\n\n";
buff[12] = "GET /cgi-bin/webdist.cgi HTTP/1.0\n\n";
buff[13] = "GET /cgi-bin/faxsurvey HTTP/1.0\n\n";
buff[14] = "GET /cgi-bin/htmlscript HTTP/1.0\n\n";
buff[15] = "GET /cgi-bin/pfdispaly.cgi HTTP/1.0\n\n";
buff[16] = "GET /cgi-bin/perl.exe HTTP/1.0\n\n";
buff[17] = "GET /cgi-bin/wwwboard.pl HTTP/1.0\n\n";
buff[18] = "GET /cgi-bin/www-sql HTTP/1.0\n\n";
buff[19] = "GET /cgi-bin/view-source HTTP/1.0\n\n";
buff[20] = "GET /cgi-bin/campas HTTP/1.0\n\n";
buff[21] = "GET /cgi-bin/aglimpse HTTP/1.0\n\n";
buff[22] = "GET /cgi-bin/glimpse HTTP/1.0\n\n";
buff[23] = "GET /cgi-bin/man.sh HTTP/1.0\n\n";
buff[24] = "GET /cgi-bin/AT-admin.cgi HTTP/1.0\n\n";
buff[25] = "GET /cgi-bin/filemail.pl HTTP/1.0\n\n";
buff[26] = "GET /cgi-bin/maillist.pl HTTP/1.0\n\n";
buff[27] = "GET /cgi-bin/jj HTTP/1.0\n\n";
buff[28] = "GET /cgi-bin/info2www HTTP/1.0\n\n";
buff[29] = "GET /cgi-bin/files.pl HTTP/1.0\n\n";
buff[30] = "GET /cgi-bin/finger HTTP/1.0\n\n";
buff[31] = "GET /cgi-bin/bnbform.cgi HTTP/1.0\n\n";
buff[32] = "GET /cgi-bin/survey.cgi HTTP/1.0\n\n";
buff[33] = "GET /cgi-bin/AnyForm2 HTTP/1.0\n\n";
buff[34] = "GET /cgi-bin/textcounter.pl HTTP/1.0\n\n";
buff[35] = "GET /cgi-bin/classifieds.cgi HTTP/1.0\n\n";
buff[36] = "GET /cgi-bin/environ.cgi HTTP/1.0\n\n";
buff[37] = "GET /cgi-bin/wrap HTTP/1.0\n\n";
buff[38] = "GET /cgi-bin/cgiwrap HTTP/1.0\n\n";
buff[39] = "GET /cgi-bin/guestbook.cgi HTTP/1.0\n\n";
buff[40] = "GET /cgi-bin/edit.pl HTTP/1.0\n\n";
buff[41] = "GET /cgi-bin/perlshop.cgi HTTP/1.0\n\n";
buff[42] = "GET /_vti_inf.html HTTP/1.0\n\n";
buff[43] = "GET /_vti_pvt/service.pwd HTTP/1.0\n\n";
buff[44] = "GET /_vti_pvt/users.pwd HTTP/1.0\n\n";
buff[45] = "GET /_vti_pvt/authors.pwd HTTP/1.0\n\n";
buff[46] = "GET /_vti_pvt/administrators.pwd HTTP/1.0\n\n";
buff[47] = "GET /_vti_bin/shtml.dll HTTP/1.0\n\n";
buff[48] = "GET /_vti_bin/shtml.exe HTTP/1.0\n\n";
buff[49] = "GET /cgi-dos/args.bat HTTP/1.0\n\n";
buff[50] = "GET /cgi-win/uploader.exe HTTP/1.0\n\n";
buff[51] = "GET /cgi-bin/rguest.exe HTTP/1.0\n\n";
buff[52] = "GET /cgi-bin/wguest.exe HTTP/1.0\n\n";
buff[53] = "GET /scripts/issadmin/bdir.htr HTTP/1.0\n\n";
buff[54] = "GET /scripts/CGImail.exe HTTP/1.0\n\n";
buff[55] = "GET /scripts/tools/newdsn.exe HTTP/1.0\n\n";
buff[56] = "GET /scripts/fpcount.exe HTTP/1.0\n\n";
buff[57] = "GET /cfdocs/expelval/openfile.cfm HTTP/1.0\n\n";
buff[58] = "GET /cfdocs/expelval/exprcalc.cfm HTTP/1.0\n\n";
buff[59] = "GET /cfdocs/expelval/displayopenedfile.cfm HTTP/1.0\n\n";
buff[60] = "GET /cfdocs/expelval/sendmail.cfm HTTP/1.0\n\n";
buff[61] = "GET /iissamples/exair/howitworks/codebrws.asp HTTP/1.0\n\n";
buff[62] = "GET /iissamples/sdk/asp/docs/codebrws.asp HTTP/1.0\n\n";
buff[63] = "GET /msads/Samples/SELECTOR/showcode.asp HTTP/1.0\n\n";
buff[64] = "GET /search97.vts HTTP/1.0\n\n";
buff[65] = "GET /carbo.dll HTTP/1.0\n\n";
buff[66] = "GET /cgi-bin/ax-admin.cgi HTTP/1.0\n\n";
buff[67] = "GET /scripts/convert.bas HTTP/1.0\n\n";
buff[68] = "GET /cgi-bin/excite HTTP/1.0\n\n";
buff[69] = "GET /cgi-bin/whois_raw.cgi HTTP/1.0\n\n";
buff[70] = "GET /cgi-bin/axs.cgi HTTP/1.0\n\n";
buff[71] = "GET /scripts/counter.exe HTTP/1.0\n\n";
buff[72] = "GET /adsamples/config/site.csc HTTP/1.0\n\n";
buff[73] = "GET /cgi-bin/responder.cgi HTTP/1.0\n\n";
buff[74] = "GET /bb-dnbd/bb-hist.sh HTTP/1.0\n\n";
buff[75] = "GET /scripts/iisadmin/ism.dll HTTP/1.0\n\n";
buff[76] = "GET /cgi-bin/environ.cgi HTTP/1.0\n\n";
buff[77] = "GET /scripts/tools/getdrvrs.exe HTTP/1.0\n\n";
buff[78] = "GET /scripts/tools/dsnform.exe HTTP/1.0\n\n";
buff[79] = "GET /scripts/samples/search/webhits.exe HTTP/1.0\n\n";
buff[80] = "GET /_vti_pvt/author.log HTTP/1.0\n\n";
buff[81] = "GET /_vti_pvt/service.grp HTTP/1.0\n\n";
buff[82] = "GET /samples/search/queryhit.htm HTTP/1.0\n\n";
buff[83] = "GET /domcfg.nsf HTTP/1.0\n\n";
buff[84] = "GET /today.nsf HTTP/1.0\n\n";
buff[85] = "GET /names.nsf HTTP/1.0\n\n";
buff[86] = "GET /catalog.nsf HTTP/1.0\n\n";
buff[87] = "GET /log.nsf HTTP/1.0\n\n";
buff[88] = "GET /domlog.nsf HTTP/1.0\n\n";
buff[89] = "GET /cgi-bin/AT-generate.cgi HTTP/1.0\n\n";
buff[90] = "GET /secure/.htaccess HTTP/1.0\n\n";
buff[91] = "GET /secure/.wwwacl HTTP/1.0\n\n";
buff[92] = "GET /cgi-bin/day5datacopier.cgi HTTP/1.0\n\n";
buff[93] = "GET /cgi-bin/day5notifier HTTP/1.0\n\n";
buff[94] = "GET /cgi-bin/dumpenv.pl HTTP/1.0\n\n";
buff[95] = "GET /scripts/../../cmd.exe HTTP/1.0\n\n";
buff[96] = "GET /WebSTAR HTTP/1.0\n\n";
buff[97] = "GET /~root HTTP/1.0\n\n";
buff[98] = "GET /logs HTTP/1.0\n\n";
cginame[1] = "UnlG - backd00r Trojan";
cginame[2] = "THC - backd00r Trojan";
cginame[3] = "phf..classic ";
cginame[4] = "Count.cgi ";
cginame[5] = "test-cgi ";
cginame[6] = "nph-test-cgi ";
cginame[7] = "nph-publish ";
cginame[8] = "php.cgi ";
cginame[9] = "handler ";
cginame[10] = "webgais ";
cginame[11] = "websendmail ";
cginame[12] = "webdist.cgi ";
cginame[13] = "faxsurvey ";
cginame[14] = "htmlscript ";
cginame[15] = "pfdisplay ";
cginame[16] = "perl.exe ";
cginame[17] = "wwwboard.pl ";
cginame[18] = "www-sql ";
cginame[19] = "view-source ";
cginame[20] = "campas ";
cginame[21] = "aglimpse ";
cginame[22] = "glimpse ";
cginame[23] = "man.sh ";
cginame[24] = "AT-admin.cgi ";
cginame[25] = "filemail.pl ";
cginame[26] = "maillist.pl ";
cginame[27] = "jj ";
cginame[28] = "info2www ";
cginame[29] = "files.pl ";
cginame[30] = "finger ";
cginame[31] = "bnbform.cgi ";
cginame[32] = "survey.cgi ";
cginame[33] = "AnyForm2 ";
cginame[34] = "textcounter.pl ";
cginame[35] = "classifields.cgi";
cginame[36] = "environ.cgi ";
cginame[37] = "wrap ";
cginame[38] = "cgiwrap ";
cginame[39] = "guestbook.cgi ";
cginame[40] = "edit.pl ";
cginame[41] = "perlshop.cgi ";
cginame[42] = "_vti_inf.html ";
cginame[43] = "service.pwd Admin cash-file";
cginame[44] = "users.pwd Admin cash-file";
cginame[45] = "authors.pwd Admin cash-file";
cginame[46] = "administrators Admin cash-file";
cginame[47] = "shtml.dll ";
cginame[48] = "shtml.exe ";
cginame[49] = "args.bat ";
cginame[50] = "uploader.exe ";
cginame[51] = "rguest.exe ";
cginame[52] = "wguest.exe ";
cginame[53] = "bdir - samples ";
cginame[54] = "CGImail.exe ";
cginame[55] = "newdsn.exe ";
cginame[56] = "fpcount.exe ";
cginame[57] = "openfile.cfm ";
cginame[58] = "exprcalc.cfm ";
cginame[59] = "dispopenedfile ";
cginame[60] = "sendmail.cfm ";
cginame[61] = "codebrws.asp ";
cginame[62] = "codebrws.asp 2 ";
cginame[63] = "showcode.asp ";
cginame[64] = "search97.vts ";
cginame[65] = "carbo.dll ";
cginame[66] = "ax-admin.cgi Admin cash-file";
cginame[67] = "convert.bas ";
cginame[68] = "excite ";
cginame[69] = "whois_raw.cgi ";
cginame[70] = "axs.cgi ";
cginame[71] = "counter.exe ";
cginame[72] = "site.csc ";
cginame[73] = "responder.cgi ";
cginame[74] = "bb-hist.sh ";
cginame[75] = "ism.dll ";
cginame[76] = "environ.cgi ";
cginame[77] = "getdrvrs.exe ";
cginame[78] = "dsnform.exe ";
cginame[79] = "webhits.exe ";
cginame[80] = "author.log Admin Log";
cginame[81] = "service.grp ";
cginame[82] = "queryhit.htm ";
cginame[83] = "domcfg.nsf ";
cginame[84] = "today.nsf ";
cginame[85] = "names.nsf ";
cginame[86] = "catalog.nsf ";
cginame[87] = "log.nsf ";
cginame[88] = "domlog.nsf ";
cginame[89] = "AT-generate.cgi ";
cginame[90] = ".htaccess ";
cginame[91] = ".wwwacl ";
cginame[92] = "day5datacopier ";
cginame[93] = "day5notifier ";
cginame[94] = "dumpenv.pl ";
cginame[95] = "cmd.exe ";
cginame[96] = "WebSTAR ";
cginame[97] = "~root Admin Root";
cginame[98] = "access.log Admin Google IP Spy";
if (argc<2)
{
printf("\n SaferBot ]2[ The network buster,");
printf("\n Vulnerability scanner......... ");
printf("\nusage : %s host ",argv[0]);
printf("\n Or : %s host -t [for test mode]\n\n",argv[0]);
exit(0);
}
if (argc>2)
{
if(strstr("-t",argv[2]))
{
debugm=1;
}
}
if ((he=gethostbyname(argv[1])) == NULL)
{
herror("gethostbyname");
exit(0);
}
printf("\n SaferBot ]2[ The network buster,\n");
printf("\n Vulnerability database scanner. \n");
printf("\n Searching database scanning... \n\t Socket Open Connecting...\n");
start=inet_addr(argv[1]);
counter=ntohl(start);
sock=socket(AF_INET, SOCK_STREAM, 0);
bcopy(he->h_addr, (char *)&sin.sin_addr, he->h_length);
sin.sin_family=AF_INET;
sin.sin_port=htons(80); /* port number 80 default */
if (connect(sock, (struct sockaddr*)&sin, sizeof(sin))!=0)
{
perror("connect");
}
printf("\n\n\t Checking WebServer Version... \n");
send(sock, "HEAD / HTTP/1.0\n\n",17,0);
recv(sock, buffer, sizeof(buffer),0);
printf("%s",buffer);
close(sock);
printf("\n\t Vulnerability Scanning... \n");
while(count++ < 98)
{
sock=socket(AF_INET, SOCK_STREAM, 0);
bcopy(he->h_addr, (char *)&sin.sin_addr, he->h_length);
sin.sin_family=AF_INET;
sin.sin_port=htons(80);
if (connect(sock, (struct sockaddr*)&sin, sizeof(sin))!=0)
{
perror("connect");
}
printf(">>> %s : ",cginame[count]);
for(numin=0;numin < 1024;numin++)
{
cgibuff[numin] = '\0';
}
send(sock, buff[count],strlen(buff[count]),0);
recv(sock, cgibuff, sizeof(cgibuff),0);
cgistr = strstr(cgibuff,foundmsg);
if( cgistr != NULL) {
printf(" <-- Found !! \n");++suxes; }
else
printf(" Not Found safe..\n");
if(debugm==1)
{
printf("\n\n >>>>>>\n %s \n <<<<<<\n",cgibuff);
printf("Press any key to continue....\n");
}
close(sock);
}
if (suxes){ printf(" Network is Exploitable and deploys deceptive services. \n");}
else { printf (" Network is Private and the administrator is recording this attempt.\n");}
}