Page 1 of 1 1
Topic Options
#121426 - 2004-06-17 03:04 PM SWAP - Start With Admin Powers
MightyR1 Offline
MM club member
*****

Registered: 1999-09-09
Posts: 1264
Loc: The Netherlands
Just something for you guys to comment on:

Usage:
  • Install the service
  • Dump neccessary files in SWAP\temp
  • Dump .SWAP file in SWAP\jobs
  • Wait


Code:

;****************************************************************************
;
;SCRIPT/FUNCTION : SWAP.kix
;
;ACTION : Run things with Admin Powers
;
;AUTHOR : Patrick Rutten (MightyR1@hotmail.com)
;
;CONTRIBUTORS : -
;
;SCRIPT VERSION : 1.0.0.0 - 2004-06-17
; Initial Release
;
;SYNTAX : None, is used in SWAP service
;
;PARAMETERS : -
;
;RETURNS : -
;
;REMARKS : After installing the Start With Admin Powers Service (see
; SWAPInstaller.kix), you are able to run things with
; admin powers.
; This script scans the SWAP\jobs folder to execute a job
; with Local System rights. After execution, the jobfile
; is moved to the SWAP\complete folder.
; .SWAP files are simple ini files, containing one section
; (command), containing one key (cmd). See Template.swap
; as an example.
;
;DEPENDENCIES : -
;
;EXAMPLE(S) : Hello.swap
; [Command]
; Cmd='c:\swap\bin\wkix32.exe c:\swap\temp\hello.kix'
; Hello.kix
; $rc=MessageBox('Hello from SWAP.','<-SWAP->',64+4096,3)
;
;KNOWN ISSUES : -
;
;KIXTART VERSION : 4.22
;
;KIXTART BBS : -
;
;****************************************************************************
;
;

;Enable Break to allow killing the script without logoff
Break on

;Set some global options
$rc=SetOption('Explicit','ON')
$rc=SetOption('NoVarsInStrings','ON')

;Declare variables
DIM $swapdir,$bindir,$completedir,$jobsdir,$logsdir,$tempdir
DIM $rc,$job

$swapdir='c:\swap'
$bindir=$swapdir+'\bin'
$completedir=$swapdir+'\complete'
$jobsdir=$swapdir+'\jobs'
$logsdir=$swapdir+'\logs'
$tempdir=$swapdir+'\temp'
$wait=60

;Infinite loop
While 1
;Check for *.swap files
$job=Dir($jobsdir+'\*.swap')
If $job
;Read the command to execute
$cmd=ReadProfileString($jobsdir+'\'+$job,'Command','Cmd')
;Execute and wait
Shell '%comspec% /c '+$cmd
;Move swap file to the complete folder
Copy $jobsdir+'\'+$job $completedir+'\'+$job
DEL $jobsdir+'\'+$job
EndIf
Sleep $wait
Loop

;Exit the script
Exit 0



Code:

;****************************************************************************
;
;SCRIPT/FUNCTION : SWAPInstaller.kix
;
;ACTION : Installs Start With Admin Powers Service
;
;AUTHOR : Patrick Rutten (MightyR1@hotmail.com)
;
;CONTRIBUTORS :
;
;SCRIPT VERSION : 1.0.0.0 - 2004-06-17
; Initial Release
;
;SYNTAX : -
;
;PARAMETERS : -
;
;RETURNS : -
;
;REMARKS : Must be an admin to install a service
;
;DEPENDENCIES : XNET.exe (in the KiXtart download)
; WKIX32.exe (in the KiXtart download)
; SRVANY.exe (in the rktools.exe download from M$)
; SWAP.kix
;
; All files must be in the same folder as this script
;
;EXAMPLE(S) : -
;
;KNOWN ISSUES : -
;
;KIXTART VERSION : 4.22
;
;KIXTART BBS : -
;
;****************************************************************************
;
;

;Enable Break to allow killing the script without logoff
Break on

;Set some global options
$rc=SetOption('Explicit','ON')
$rc=SetOption('NoVarsInStrings','ON')

;Declare variables
Dim $variables

DIM $swapdir,$bindir,$completedir,$jobsdir,$logsdir,$tempdir
DIM $rc,$job
DIM $swapclient

;Get the SWAPclient
cls
'Give the machine name to install the SWAP service on (\\MACHINE):' ?
gets $swapclient

;Check if Client exist
$rc=Dir($swapclient+'\c$\boot.ini')
if @error
? 'Error connecting to '+$swapclient+' (EC='+@error+')'
exit 1
endif

;Assign variables
$swapdir=$swapclient+'\c$\swap'
$bindir=$swapdir+'\bin'
$completedir=$swapdir+'\complete'
$jobsdir=$swapdir+'\jobs'
$logsdir=$swapdir+'\logs'
$tempdir=$swapdir+'\temp'

;Create SWAP structure
MD $swapdir
MD $bindir
MD $completedir
MD $jobsdir
MD $logsdir
MD $tempdir

Copy @SCRIPTDIR+'.' $bindir

;Install SWAP Service
shell @SCRIPTDIR+'\XNET INSTALL '+$swapclient+'\SWAP /b:c:\swap\bin\srvany.exe'

;Modify SWAP Service settings
$rc=WriteValue($swapclient+'\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SWAP','Description','Start With Admin Powers Service','REG_SZ')
$rc=WriteValue($swapclient+'\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SWAP','DisplayName','SWAP','REG_SZ')
$rc=WriteValue($swapclient+'\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SWAP','ErrorControl',&1,'REG_DWORD')
$rc=WriteValue($swapclient+'\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SWAP','ImagePath','c:\swap\bin\srvany.exe','REG_EXPAND_SZ')
$rc=WriteValue($swapclient+'\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SWAP','ObjectName','LocalSystem','REG_SZ')
$rc=WriteValue($swapclient+'\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SWAP','Start',&2,'REG_DWORD')
$rc=WriteValue($swapclient+'\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SWAP','Type',&110,'REG_DWORD')

$rc=WriteValue($swapclient+'\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SWAP\Parameters','AppDirectory','c:\swap\temp','REG_SZ')
$rc=WriteValue($swapclient+'\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SWAP\Parameters','AppEnvironment','','REG_SZ')
$rc=WriteValue($swapclient+'\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SWAP\Parameters','Application','c:\swap\bin\wkix32.exe','REG_SZ')
$rc=WriteValue($swapclient+'\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SWAP\Parameters','AppParameters','c:\swap\bin\swap.kix','REG_SZ')

$rc=WriteValue($swapclient+'\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SWAP\Security','Security', +
'01001480a0000000ac000000140000003000000002001c0001000000028' +
'01400ff010f00010100000000000100000000020070000400000000001800fd010200010100000000000512000000' +
'7300000000001c00ff010f000102000000000005200000002002000000006500000018008d0102000101000000000' +
'0050b0000002002000000001c00fd0102000102000000000005200000002302000000006500010100000000000512' +
'000000010100000000000512000000','REG_BINARY')

;Start SWAP Service
shell @SCRIPTDIR+'\XNET START '+$swapclient+'\SWAP'

get $rc

;Exit the script
Exit 0



Edited by MightyR1 (2004-06-17 03:48 PM)
_________________________
Greetz,
Patrick Rutten

- We'll either find a way or make one...
- Knowledge is power; knowing how to find it is more powerful...
- Problems don't exist; they are challenges...

Top
#121427 - 2004-06-17 03:31 PM Re: SWAP - Start With Admin Powers
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
2 things

1- Les is going to get you.... You are in trouble.
2 - what is the permission on the swap folder... I'd hate to se a user get in there and put format c: in one of the job files
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#121428 - 2004-06-17 03:35 PM Re: SWAP - Start With Admin Powers
MightyR1 Offline
MM club member
*****

Registered: 1999-09-09
Posts: 1264
Loc: The Netherlands
1. Should I be afraid?

2. Everyone change for the jobs folder; Doesn't matter if they do a format C:, it's their own workstation. Simply wait a few days before giving them a new one each time they mess up their PC...
_________________________
Greetz,
Patrick Rutten

- We'll either find a way or make one...
- Knowledge is power; knowing how to find it is more powerful...
- Problems don't exist; they are challenges...

Top
#121429 - 2004-06-17 03:41 PM Re: SWAP - Start With Admin Powers
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
1. Yes
You could have broken up that looooooong line. tsk, tsk

2. Users could elevate their permission and kick you off.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#121430 - 2004-06-17 03:52 PM Re: SWAP - Start With Admin Powers
MightyR1 Offline
MM club member
*****

Registered: 1999-09-09
Posts: 1264
Loc: The Netherlands
Quote:

1. Yes
You could have broken up that looooooong line. tsk, tsk

2. Users could elevate their permission and kick you off.




1. Made it shorter
2. I'll let their boss kick them Thing is they can't do any harm on the network, only on their own PC.
_________________________
Greetz,
Patrick Rutten

- We'll either find a way or make one...
- Knowledge is power; knowing how to find it is more powerful...
- Problems don't exist; they are challenges...

Top
#121431 - 2004-06-17 03:56 PM Re: SWAP - Start With Admin Powers
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
1. Thanks

2. If they can get a trojan to another PC, they can elevate themself on it too. Then they can use the network to hack to it.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#121432 - 2004-06-17 04:11 PM Re: SWAP - Start With Admin Powers
MightyR1 Offline
MM club member
*****

Registered: 1999-09-09
Posts: 1264
Loc: The Netherlands
2. My users even call Support if they need to make a word in Bold in MS Word So no worries here.
_________________________
Greetz,
Patrick Rutten

- We'll either find a way or make one...
- Knowledge is power; knowing how to find it is more powerful...
- Problems don't exist; they are challenges...

Top
#121433 - 2004-06-17 08:40 PM Re: SWAP - Start With Admin Powers
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11628
Loc: CA
Quote:

2. Users could elevate their permission and kick you off.




Then remove their computer from the Domain and disable their port at the switch. Then when they call the helpdesk say you're checking into the problem but don't do anything to fix it for a couple days.

After a couple times of that action, they get tired of it and won't remove your Domain Account.

Les,
I think you need to let some of your workers go, they don't appear to be office workers but rather young kids that like to think they can hack.

Top
#121434 - 2004-06-18 12:23 AM Re: SWAP - Start With Admin Powers
MightyR1 Offline
MM club member
*****

Registered: 1999-09-09
Posts: 1264
Loc: The Netherlands
Quote:

they don't appear to be office workers but rather young kids that like to think they can hack.




Smart users? Didn't even know they exist.
_________________________
Greetz,
Patrick Rutten

- We'll either find a way or make one...
- Knowledge is power; knowing how to find it is more powerful...
- Problems don't exist; they are challenges...

Top
#121435 - 2004-06-18 01:03 AM Re: SWAP - Start With Admin Powers
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
they don't.
they are just imaginary friends of les...
he must be bored in his office...
_________________________
!

download KiXnet

Top
#121436 - 2004-06-18 02:13 AM Re: SWAP - Start With Admin Powers
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Lonk is right. My users are not that smart. Since I am DivIT, I am that user from hell that keeps CorpIT awake at night.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
Page 1 of 1 1


Moderator:  Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Allen) and 1198 anonymous users online.
Newest Members
M_Moore, BeeEm, min_seow, Audio, Hoschi
17883 Registered Users

Generated in 0.063 seconds in which 0.027 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org