לוגו אתר Fresh          
 
 
  אפשרות תפריט  ראשי     אפשרות תפריט  צ'אט     אפשרות תפריט  מבזקים     אפשרות תפריט  צור קשר     חץ שמאלה חץ ימינה  

לך אחורה   לובי הפורומים > מחשבים > מערכות הפעלה
שמור לעצמך קישור לדף זה באתרי שמירת קישורים חברתיים
תגובה
 
כלי אשכול חפש באשכול זה



  #1  
ישן 26-08-2008, 20:12
  The_Equivocator The_Equivocator אינו מחובר  
 
חבר מתאריך: 11.02.04
הודעות: 16,543
עזרה עם VB סקריפט. בXP

מצאתי את הסקריפט הבא שאמור להריץ את הפקודה RUNAS.
הבעיה שאני לא ממש מבין בVBS, לא הצלחתי להבין באיזה מקום עלי לרשום את הפקודה, שם המשתמש והסיסמה- נסיתי וזה לא ממש הלך, כנראה לא עשיתי משהו כמו שצריך.
על כל פנים זהו הסקריפט.

'Start of Script
'VBRUNAS.VBS
'v1.2 March 2001
'Jeffery Hicks
'jhicks@quilogy.com http://www.quilogy.com
'USAGE: cscript|wscript VBRUNAS.VBS Username Password Command
'DESC: A RUNAS replacement to take password at a command prompt.
'NOTES: This is meant to be used for local access. If you want to run a command
'across the network as another user, you must add the /NETONLY switch to the RUNAS
'command.

' ************************************************** *******************************
' * THIS PROGRAM IS OFFERED AS IS AND MAY BE FREELY MODIFIED OR ALTERED AS *
' * NECESSARY TO MEET YOUR NEEDS. THE AUTHOR MAKES NO GUARANTEES OR WARRANTIES, *
' * EXPRESS, IMPLIED OR OF ANY OTHER KIND TO THIS CODE OR ANY USER MODIFICATIONS. *
' * DO NOT USE IN A PRODUCTION ENVIRONMENT UNTIL YOU HAVE TESTED IN A SECURED LAB *
' * ENVIRONMENT. USE AT YOUR OWN RISK. *
' ************************************************** *******************************

On Error Resume Next
dim WshShell,oArgs,FSO

set oArgs=wscript.Arguments

if InStr(oArgs(0),"?")<>0 then
wscript.echo VBCRLF & "? HELP ?" & VBCRLF
Usage
end if

if oArgs.Count <3 then
wscript.echo VBCRLF & "! Usage Error !" & VBCRLF
Usage
end if

sUser=oArgs(0)
sPass=oArgs(1)&VBCRLF
sCmd=oArgs(2)

set WshShell = CreateObject("WScript.Shell")
set WshEnv = WshShell.Environment("Process")
WinPath = WshEnv("SystemRoot")&"\System32\runas.exe"
set FSO = CreateObject("Scripting.FileSystemObject")

if FSO.FileExists(winpath) then
'wscript.echo winpath & " " & "verified"
else
wscript.echo "!! ERROR !!" & VBCRLF & "Can't find or verify " & winpath &"." & VBCRLF & "You must be running Windows 2000 for this script to work."
set WshShell=Nothing
set WshEnv=Nothing
set oArgs=Nothing
set FSO=Nothing
wscript.quit
end if

rc=WshShell.Run("runas /user:" & sUser & " " & CHR(34) & sCmd & CHR(34), 2, FALSE)
Wscript.Sleep 30 'need to give time for window to open.
WshShell.AppActivate(WinPath) 'make sure we grab the right window to send password to
WshShell.SendKeys sPass 'send the password to the waiting window.

set WshShell=Nothing
set oArgs=Nothing
set WshEnv=Nothing
set FSO=Nothing

wscript.quit

'************************
'* Usage Subroutine *
'************************
Sub Usage()
On Error Resume Next
msg="Usage: cscript|wscript vbrunas.vbs Username Password Command" & VBCRLF & VBCRLF & "You should use the full path where necessary and put long file names or commands" & VBCRLF & "with parameters in quotes" & VBCRLF & VBCRLF &"For example:" & VBCRLF &" cscript vbrunas.vbs quilogy\jhicks luckydog e:\scripts\admin.vbs" & VBCRLF & VBCRLF &" cscript vbrunas.vbs quilogy\jhicks luckydog " & CHR(34) &"e:\program files\scripts\admin.vbs 1stParameter 2ndParameter" & CHR(34)& VBCRLF & VBCRLF & VBCLRF & "cscript vbrunas.vbs /?|-? will display this message."

wscript.echo msg

wscript.quit

end sub
'End of Script

אגב הסיבה שאני לא משתמש ב runas /savecred
היא שמדובר כמובן בחור אבטחה אחד גדול...

נערך לאחרונה ע"י The_Equivocator בתאריך 26-08-2008 בשעה 20:15.
תגובה ללא ציטוט תגובה עם ציטוט חזרה לפורום
  #2  
ישן 27-08-2008, 12:31
  משתמש זכר KaHT KaHT אינו מחובר  
 
חבר מתאריך: 04.05.08
הודעות: 390
בתגובה להודעה מספר 1 שנכתבה על ידי The_Equivocator שמתחילה ב "עזרה עם VB סקריפט. בXP"

פשוט מאוד, דרך ה cmd, לדוגמא:
cscript vbrunas.vbs domain\user password c:\path\file.exe
באותו הקשר, מצאתי לך סקריפט כזה אבל שחוסך לך את ההקלדה של היוזר והסיסמא בכל פעם:

קוד:
'Start of Script 'RUNAS.VBS 'USAGE: cscript|wscript VBRUNAS.VBS domain\user password "path\to\file.exe" 'DESC: A RUNAS replacement to take password at a command prompt. 'NOTES: This is meant to be used for local access. If you want to run a command 'across the network as another user, you must add the /NETONLY switch to the RUNAS 'command. 'On Error Resume Next 'dim WshShell,oArgs,FSO 'set oArgs=wscript.Arguments 'if InStr(oArgs(0),"?")&lt;&gt;0 then 'wscript.echo VBCRLF &amp; "? HELP ?" &amp; VBCRLF 'Usage 'end if 'if oArgs.Count &lt;3 then 'wscript.echo VBCRLF &amp; "! Usage Error !" &amp; VBCRLF 'Usage 'end if sUser="domain\user" sPass="password"&amp;VBCRLF sCmd="c:\program files\microsoft office\office10\outlook.exe /recycle" set WshShell = CreateObject("WScript.Shell") set WshEnv = WshShell.Environment("Process") WinPath = WshEnv("SystemRoot")&amp;"\System32\runas.exe" set FSO = CreateObject("Scripting.FileSystemObject") if FSO.FileExists(winpath) then 'wscript.echo winpath &amp; " " &amp; "verified" else wscript.echo "!! ERROR !!" &amp; VBCRLF &amp; "Can't find or verify " &amp; winpath &amp;"." &amp; VBCRLF &amp; "You must be running Windows 2000 or XP for this script to work." set WshShell=Nothing set WshEnv=Nothing set oArgs=Nothing set FSO=Nothing wscript.quit end if 'Use this line for remote file access and comment out the line below 'rc=WshShell.Run("runas /netonly /user:" &amp; sUser &amp; " " &amp; CHR(34) &amp; sCmd &amp; CHR(34), 2, FALSE) 'Use this line for local file access and comment out the above line rc=WshShell.Run("runas /user:" &amp; sUser &amp; " " &amp; CHR(34) &amp; sCmd &amp; CHR(34), 2, FALSE) Wscript.Sleep 30 'need to give time for window to open. WshShell.AppActivate(WinPath) 'make sure we grab the right window to send password to WshShell.SendKeys sPass 'send the password to the waiting window. set WshShell=Nothing set oArgs=Nothing set WshEnv=Nothing set FSO=Nothing wscript.quit '************************ '* Usage Subroutine * '************************ Sub Usage() On Error Resume Next msg="Usage: cscript|wscript runas.vbs Username Password Command" &amp; VBCRLF &amp; VBCRLF &amp; "You should use the full path where necessary and put long file names or commands" &amp; VBCRLF &amp; "with parameters in quotes" &amp; VBCRLF &amp; VBCRLF &amp;"For example:" &amp; VBCRLF &amp;" cscript runas.vbs domain\admin luckydog e:\scripts\admin.vbs" &amp; VBCRLF &amp; VBCRLF &amp;" cscript runas.vbs domain\admin luckydog " &amp; CHR(34) &amp;"e:\program files\scripts\admin.vbs 1stParameter 2ndParameter" &amp; CHR(34)&amp; VBCRLF &amp; VBCRLF &amp; VBCLRF &amp; "cscript runas.vbs /?|-? will display this message." wscript.echo msg wscript.quit end sub 'End of Script

הערכים שתצטרך לשנות בקובץ הם:
sUser="domain\user"
sPass="password"&amp;VBCRLF
sCmd="c:\program files\microsoft office\office10\outlook.exe /recycle"

תהנה (:
_____________________________________
תמונה שהועלתה על ידי גולש באתר ולכן אין אנו יכולים לדעת מה היא מכילה

תגובה ללא ציטוט תגובה עם ציטוט חזרה לפורום
תגובה

כלי אשכול חפש באשכול זה
חפש באשכול זה:

חיפוש מתקדם
מצבי תצוגה דרג אשכול זה
דרג אשכול זה:

מזער את תיבת המידע אפשרויות משלוח הודעות
אתה לא יכול לפתוח אשכולות חדשים
אתה לא יכול להגיב לאשכולות
אתה לא יכול לצרף קבצים
אתה לא יכול לערוך את ההודעות שלך

קוד vB פעיל
קוד [IMG] פעיל
קוד HTML כבוי
מעבר לפורום



כל הזמנים המוצגים בדף זה הם לפי איזור זמן GMT +2. השעה כעת היא 11:12

הדף נוצר ב 0.06 שניות עם 12 שאילתות

הפורום מבוסס על vBulletin, גירסא 3.0.6
כל הזכויות לתוכנת הפורומים שמורות © 2024 - 2000 לחברת Jelsoft Enterprises.
כל הזכויות שמורות ל Fresh.co.il ©

צור קשר | תקנון האתר