注意使用完後記得切回原來使用者身份,以免該使用者使用你的許可權操作共享!注意使用完後記得切回原來使用者身份,以免該使用者使用你的許可權操作共享!
1 . 使用net use
斷開已有的使用者連線
net use * /del /y
2 . 使用新賬號net use
到共享
rem 不一定要使用ipc$,可以用已有的路徑
net use \\share-server-ip\ipc$
3 . 呼叫explorer.exe開啟共享
explorer \\share-server
-ip
以下為c#版工具原始碼和示意圖,可自行定製修改
#include
$server = "\\192.168.241.135"
$netbios_name = "test\"
maingui()
func maingui()
local $button,$msg
guicreate("共享切換工具",300,200)
$button = guictrlcreatebutton("下一步",100,100,100)
$label = guictrlcreatelabel("請確保本程式是複製到本地電腦再執行!",50,30)
$label2 = guictrlcreatelabel("請關閉所有開啟的" & $server &"視窗!",50,50)
$button1 = guictrlcreatebutton("下一步",100,150,100)
$namel = guictrlcreatelabel("帳號:",50,70)
$passl = guictrlcreatelabel("密碼:",50,90)
$name = guictrlcreateinput("
",90,70,120)
$pass = guictrlcreateinput("
",90,90,120)
guictrlsetstate($button1,$gui_hide)
guictrlsetstate($namel,$gui_hide)
guictrlsetstate($passl,$gui_hide)
guictrlsetstate($name,$gui_hide)
guictrlsetstate($pass,$gui_hide)
dim $keys[1][2] = [["
",$button]]
dim $keys2[1][2] = [["
",$button1]]
guisetaccelerators($keys)
guisetstate()
while 1
$msg = guigetmsg()
select
case $msg = $gui_event_close
exitloop
case $msg = $button
guictrlsetdata($label,"正在斷開與" & $server & "的連線!")
guictrldelete($button)
guictrldelete($label2)
processwaitclose(runwait("net use * /del /y
","",@sw_hide),30)
guictrlsetdata($label," 請正確輸入使用者名稱和密碼!")
guictrlsetstate($button1,$gui_show)
guictrlsetstate($namel,$gui_show)
guictrlsetstate($passl,$gui_show)
guictrlsetstate($name,$gui_show)
guictrlsetstate($pass,$gui_show)
guisetaccelerators($keys2)
case $msg = $button1
$nameget = guictrlread($name)
$passget = guictrlread($pass)
guictrldelete($label)
guictrldelete($button1)
guictrldelete($namel)
guictrldelete($passl)
guictrldelete($name)
guictrldelete($pass)
guictrlcreatelabel("正在建立與" & $server & "的新的連線!",50,90)
processwaitclose(run("net use
" & $server & "\ipc$ " & $passget & " /user:" & $netbios_name & $nameget,"
",@sw_hide),30)
if @extended = 0 then
run("explorer.exe " & $server)
exit(1)
else
msgbox(0,"共享盤切換?","帳號密碼錯誤,或者" & $server & "未完全關閉,請重試!")
exit(0)
endif
endselect
wend
endfunc
部分關鍵**
public
partial
class form1 : form
private
static
string server = @"192.168.241.135";
// 輸入你的域netbios名,非域環境為空
private
static
string domain = @"";
private
delegate
void
settexthandler(string text);
private
delegate
void
enableloginhandler();
private thread th;
private process p;
private
void
settext(string text)
else
}private
void
enablelogin()
else
}private
void
domain()
\ipc$ /user:", server, tbpwd.text, domain, tbaccount.text));
p.standardinput.writeline("exit");
string ret = p.standarderror.readtoend();
settext("正在開啟共享!");
if (ret.contains("不允許乙個使用者使用乙個以上使用者名稱與伺服器或共享資源的多重連線"))
else
if (ret == "")
", server));
}else
p.waitforexit();
enablelogin();
}private
void
btnlogin_click(object sender, eventargs e)
btnlogin.enabled = false;
th = new thread(domain);
th.start();
}private
void
form1_formclosed(object sender, formclosedeventargs e)
private
void
tbaccount_textchanged(object sender, eventargs e)
}
ssh免賬號登陸
1 在當前使用者目錄下建立.ssh目錄,生成key mkdir ssh ssh keygen t dsa p f ssh id dsa 2 儲存認證鍵值到authorized keys檔案 cat ssh id dsa.pub ssh authorized keys 3 改變.ssh下檔案屬性,以及...
登陸失敗賬號鎖定
一 session 清空登入失敗記錄 cleanfailnum session,username 校驗使用者登入失敗次數 新增使用者登入失敗次數 清理使用者登入失敗的記錄 二 map 移出非安全登入記錄 param index private void removejptloginsecurity ...
如何得到本機登陸賬號
如何在這裡得到本機登陸賬號 員工號 以下是 language vbscript 考勤資料 考勤資料 dim fromday,today dim tempdate tempdate formatdatetime date 1,2 today cstr year tempdate if month te...