Sponsored Content
Top Forums Shell Programming and Scripting Cannot kill hacker process with my script Post 302441730 by thsecmaniac on Monday 2nd of August 2010 07:15:00 AM
Old 08-02-2010
Cannot kill hacker process with my script

I want to kill a process of xterm that is run by hacker with my login name.
So, I write a shell script to do my goal.
I run 2 xterm and then I run my script on a first xterm. it should kill the process of a second xterm but it doesn't.Why?

Here is my code :
Code:
#!/bin/ksh
myps=$(ps -f|grep xterm|cut -d ' ' -f3)
mytty=$(tty|cut -c 6-10)
hackerps=$(ps -fu $(logname)|grep xterm| cut -d ' ' -f3)
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 ]
#!/bin/ksh
myps=$(ps -f|grep xterm|cut -d ' ' -f3)
mytty=$(tty|cut -c 6-10)
hackerps=$(ps -fu $(logname)|grep xterm| cut -d ' ' -f3)
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
     for j in ${#hackerttycurrent[*]}
     do
     if [ $hackerttycurrent[j] != $mytty ]
     then
        ttyother=$(( ttyother+1 ))
        kill -9 $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
     done
 fi
 echo $i

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

my process id is a string so it cannot kill by this command "kill -9 processid"?
 

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
RESIZE(1)                                                     General Commands Manual                                                    RESIZE(1)

NAME
resize - set environment and terminal settings to current xterm window size SYNOPSIS
resize [ -u | -c ] [ -s [ row col ] ] DESCRIPTION
Resize prints a shell command for setting the appropriate environment variables to indicate the current size of xterm window from which the command is run. For this output to take effect, resize must either be evaluated as part of the command line (usually done with a shell alias or function) or else redirected to a file which can then be read in. From the C shell (usually known as /bin/csh), the following alias could be defined in the user's .cshrc: % alias rs 'set noglob; eval `resize`' After resizing the window, the user would type: % rs Users of versions of the Bourne shell (usually known as /bin/sh) that don't have command functions will need to send the output to a tempo- rary file and then read it back in with the "." command: $ resize > /tmp/out $ . /tmp/out Resize determines the user's current shell by first checking if $SHELL is set, and using that. Otherwise it determines the user's shell by looking in the password file. Generally Bourne-shell variants (including ksh) do not modify $SHELL, so it is possible for resize to be confused if one runs resize from a Bourne shell spawned from a C shell. OPTIONS
The following options may be used with resize: -u This option indicates that Bourne shell commands should be generated even if the user's current shell isn't /bin/sh. -c This option indicates that C shell commands should be generated even if the user's current shell isn't /bin/csh. -s [rows columns] This option indicates that Sun console escape sequences will be used instead of the VT100-style xterm escape codes. If rows and columns are given, resize will ask the xterm to resize itself. However, the window manager may choose to disallow the change. Note that the Sun console escape sequences are recognized by XFree86 xterm and by dtterm. The resize program may be installed as sunsize, which causes makes it assume the -s option. The rows and columns arguments must appear last; though they are normally associated with the -s option, they are parsed separately. FILES
/etc/termcap for the base termcap entry to modify. ~/.cshrc user's alias for the command. ENVIRONMENT
TERM set to "xterm" if not already set. TERMCAP variable set on systems using termcap COLUMNS, LINES variables set on systems using terminfo SEE ALSO
csh(1), tset(1), xterm(1) AUTHORS
Mark Vandevoorde (MIT-Athena), Edward Moy (Berkeley) Copyright (c) 1984, 1985 by X Consortium See X(7) for a complete copyright notice. X Window System RESIZE(1)
All times are GMT -4. The time now is 02:42 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy