Sponsored Content
Top Forums Shell Programming and Scripting Cannot kill hacker process with my script Post 302442303 by thsecmaniac on Wednesday 4th of August 2010 01:56:07 AM
Old 08-04-2010
It's work but it kill my process too in sometime but sometime it does as my goal. Why?
Code:
#!/bin/ksh
myps=$(ps -f|grep xterm|awk '{print $2}')
mytty=$(tty|cut -c 6-10)
hackerps=$(ps -fu $(logname)|grep xterm| awk '{print $2}')
hackertty=$(ps -fu $(logname)| grep xterm | cut -d ' ' -f10)
set -A mycurrent $myps
set -A hackercurrent $hackerps
set -A hackerttycurrent $hackertty
i=0

ttyother=0
while [ $i -le 400 ]
do
 if [ $i -eq 390 ]
 then
     j=0
     while [ $j -lt ${#hackerttycurrent[*]} ]
     do
     if [ ${hackerttycurrent[$j]} != $mytty ]
     then
        ttyother=$(( ttyother+1 ))
        kill ${hackercurrent[$j]}
        echo Kill $ttyother other terminal already
     else
     echo Now has $ttyother other terminal run by $(logname)
        echo None of other terminal was killed
     fi
     j=$(( j+1 ))
     done
 fi
 echo $i

 i=$(( i+1))
done
banner Program Finish!

 

7 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script to kill process

Hello guys, I have a process named monitoreo, with 'monitoreo start' my process start until i kill them, now i want to do 'monitoreo stop' to kill them. After 'monitoreo start' i have this process running: ps -af UID PID PPID C STIME TTY TIME CMD ati 10958 1495 ... (5 Replies)
Discussion started by: Lestat
5 Replies

2. Shell Programming and Scripting

Script to kill process...

hello Bros, I need to write some script that i can put it on crontab which checks for a process X if running. If the process X is ruuning then take the PID and kill it or display message that says process X is not running. I am using AIX 5.3 Thanks guys.:b: (2 Replies)
Discussion started by: malcomex999
2 Replies

3. Shell Programming and Scripting

Shell Script to Kill Process(number of process) Unix/Solaris

Hi Experts, we do have a shell script for Unix Solaris, which will kill all the process manullay, it used to work in my previous env, but now it is throwing this error.. could some one please help me to resolve it This is how we execute the script (and this is the requirement) ... (2 Replies)
Discussion started by: jonnyvic
2 Replies

4. Shell Programming and Scripting

Script to Kill a Process by Name...

Hello all... new to these forums and a bit of a newbie with linux aswell. I need to figure out how to write a shell script to kill a process by name as given to the script as an argument. I've got that part working OK, but i need to make sure that the script does not allow processes that are... (6 Replies)
Discussion started by: cannon1707
6 Replies

5. UNIX for Dummies Questions & Answers

Script to start background process and then kill process

What I need to learn is how to use a script that launches background processes, and then kills those processes as needed. The script successfully launches the script. But how do I check to see if the job exists before I kill it? I know my problem is mostly failure to understand parameter... (4 Replies)
Discussion started by: holocene
4 Replies

6. Shell Programming and Scripting

kill my processes which are run by hacker

how can I kill my processes which are run by hacker or another person who log in with my username and password (1 Reply)
Discussion started by: thsecmaniac
1 Replies

7. Shell Programming and Scripting

Kill all child process of a script

Hi guys i have a problem with a script... this script creates differents GUI with YAD... well i want that when i press the "Cancel" button on this graphical interface all the child process and even the same script should be killed #!/bin/bash function gui_start { local choice="" ... (4 Replies)
Discussion started by: maaaaarco
4 Replies
ZGREP(1)						      General Commands Manual							  ZGREP(1)

NAME
zgrep - search possibly compressed files for a regular expression SYNOPSIS
zgrep [ grep_options ] [ -e ] pattern filename... DESCRIPTION
Zgrep invokes grep on compressed or gzipped files. These grep options will cause zgrep to terminate with an error code: (-[drRzZ]|--di*|--exc*|--inc*|--rec*|--nu*). All other options specified are passed directly to grep. If no file is specified, then the standard input is decompressed if necessary and fed to grep. Otherwise the given files are uncompressed if necessary and fed to grep. If the GREP environment variable is set, zgrep uses it as the grep program to be invoked. EXIT CODE
2 - An option that is not supported was specified. AUTHOR
Charles Levert (charles@comm.polymtl.ca) SEE ALSO
grep(1), gzexe(1), gzip(1), zdiff(1), zforce(1), zmore(1), znew(1) ZGREP(1)
All times are GMT -4. The time now is 03:14 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy