Disponibilizo código fonte da aplicação TeamViewer Manager, um simples gerenciador de credenciais usando linguagem Hypertext Application e VBScript, com ele você poderá manter salvo os IDS e senhas utilizados para conexão com seus parceiros ou clientes.
A aplicação salva as informações em um DB e mantém log de todas as ações realizadas pelos utilizadores.
Screenshots
Código fonte
Código: Selecionar todos
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<head>
<meta name="author" content="Marcelo Leães - [email protected]">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>TeamViewer Manager - Versão 1.0</title>
<HTA:APPLICATION
BORDER="Thin"
CAPTION="yes"
APPLICATIONNAME="TeamViewer Manager - Versão 1.0"
MAXIMIZEBUTTON="no"
MINIMIZEBUTTON="yes"
SINGLEINSTANCE="yes"
SHOWINTASKBAR="no"
SYSMENU="yes"
SCROLL="no"
SCROLLFLAT="yes"
SELECTION="no"
WINDOWSTATE="normal" />
<style>
body{
background-color: #FFFFFF;
}
a{
background-color: #FFFFFF;
}
.input {
font-weight: bold;
border: solid #000000 1px;
color: #000000;
width: 300px;
}
.showpass {
font-weight: bold;
border: dotted #000000 1px;
color: #000000;
width: 50px;
}
.input-submit {
font-weight: bold;
border: solid #000000 1px;
color: #000000;
width: 200px;
}
.input-newid {
font-weight: bold;
border: solid #000000 1px;
color: #000000;
width: 150px;
}
.input-delete {
font-weight: bold;
color: #FF0000;
border: solid #000000 1px;
width: 200px;
}
.caption {
font-weight: bold;
color: #000000;
}
</style>
<script language="javascript">
TeamViewerWidth = 650;
TeamViewerHeight = 250;
window.resizeTo(TeamViewerWidth, TeamViewerHeight);
window.moveTo((window.screen.availWidth-TeamViewerWidth)/2, (window.screen.availHeight-TeamViewerHeight)/2);
</script>
<script language="vbscript">
Option Explicit
Dim i, TeamViewerID, TeamViewerPass, wsh, cmdcommand, k, PasswordPrompt_spliter
Dim objFSO, objFile, f, numberofrowsintvdbtxt, TeamViewerArraySplitter, TeamViewerSelectedID, TeamViewerSelectedDescription, TeamViewerSelectedPassword, TeamViewerManagerDataBaseFile
TeamViewerManagerDataBaseFile = "TeamViewerManager.db"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile(TeamViewerManagerDataBaseFile, 1, true)
IF objFSO.FileExists(TeamViewerManagerDataBaseFile) THEN
f = 0
Do Until objFile.AtEndOfStream
Redim TeamViewerArraySplitter(f)
Redim Preserve TeamViewerArray_ID(f)
Redim Preserve TeamViewerArray_Pass(f)
Redim Preserve TeamViewerArray_Desc(f)
TeamViewerArraySplitter(f) = split(objFile.ReadLine, VBTab)
If UBound(TeamViewerArraySplitter(f)) > 0 then
TeamViewerArray_ID(f) = TeamViewerArraySplitter(f)(0)
TeamViewerArray_Pass(f) = TeamViewerArraySplitter(f)(1)
TeamViewerArray_Desc(f) = TeamViewerArraySplitter(f)(2)
f = f + 1
end if
Loop
numberofrowsintvdbtxt = f - 1
objFile.Close
end if
</script>
<script type='text/javascript'>
function textToPassword( elem )
{
var eData={v:elem.value, t:elem.type, s:elem.size, n:elem.name},
newElem, newType=(eData.t=='password'?'text':'password');
try
{
newElem=document.createElement("<input type='"+newType+"' name='"+eData.n+"' value='"+eData.v+"' class='input'>");
}
catch(e)
{
newElem=document.createElement('input');
newElem.name=eData.n;
newElem.name=eData.n;
newElem.type=newType;
newElem.size=eData.s;
newElem.value=eData.v;
}
elem.parentNode.replaceChild(newElem, elem);
return newElem.type;
}
</script>
<script language="JavaScript" type="text/javascript">
function Disable(cb,but){
var cbs=document.getElementsByName(cb.name);
but=cbs[0].form[but]
but.setAttribute('disabled','disabled');
but.setAttribute('class','');
for (var zxc0=0;zxc0<cbs.length;zxc0++){
if (cbs[zxc0].checked){
but.removeAttribute('disabled');
but.setAttribute('class', 'input-delete');
break;
}
}
}
</script>
</head>
<body onload="Welcome_OnLoad();" style="margin: 0px 0px 0px 0px;" style="filter:progid:DXImageTransform.Microsoft.Gradient (GradientType=0, StartColorStr='#ddd7ff', EndColorStr='#006d9f')">
<script language="javascript">
document.write("<table border=\"0\" wdth=\"" + TeamViewerWidth + "\" height=\"" + TeamViewerHeight + "\">");
</script>
<tr>
<td width="300" align="middle" valign="top" height="100%">
<select size="10" name="TeamViewerIDnum" onClick="General_OnClick()">
<option value="-1">--- TeamViewer ID ---</option>
<script language="vbscript">
For k=0 to numberofrowsintvdbtxt
Document.Write "<option value=" & k & ">" & TeamViewerArray_ID(k) & "</option>"
Next
</script>
</select>
<br /><br />
<input type="button" value="Adicionar um novo ID" class="input-newid" onclick="NewID_OnClick()">
</td>
<td width="1px" style="filter:progid:DXImageTransform.Microsoft.Gradient (GradientType=0, StartColorStr='#006d9f', EndColorStr='#ddd7ff')"></td>
<td width="100%" align="left" valign="top">
<div id="dataarea"></div>
</td>
</tr>
</table>
<script language="vbscript">
tNow = Now
tMth = Right("0" & Month(tNow), 2)
tDay = Right("0" & Day(tNow), 2)
tYr = Right("00" & Year(tNow), 4)
tHr = Right("0" & Hour(tNow), 2)
tMin = Right("0" & Minute(tNow), 2)
tSec = Right("0" & Second(tNow), 2)
DTFileName = tDay & "." & tMth & "." & tYr & "_" & tHr & "h" & tMin & "m" & tSec & "s"
CurrentTimeStamp = tDay & tMth & tYr
Sub Welcome_OnLoad()
dataarea.innerhtml = "<br /><br /><center><h2>Bem vindo ao TeamViewer Manager</h2><br /><h3>Versão 1.0</h3><br /></a></center>"
end sub
Sub General_OnClick()
If TeamViewerIDnum.Value = "-1" OR TeamViewerIDnum.Value = "" Then
strHtm = "<br /><br /><br /><br /><center><h2>Selecione um TeamViewer ID</h2></center>"
else
strHtm = "<form name=""frmData"">"
strHtm = strHtm & "<table border=""0"" width=""100%"" height=""100%"" valign=""top"">"
strHtm = strHtm & "<tr><td width=""150"" class=""caption"">ID do TeamViewer</td><td><input type=""text"" name=""TeamViewerSelectedID"" class=""input"" value=""" & TeamViewerArray_ID(TeamViewerIDnum.Value) & """></td></tr>"
strHtm = strHtm & "<tr><td width=""150"" class=""caption"">Descrição da Conexão</td><td><input type=""text"" name=""TeamViewerSelectedDescription"" class=""input"" value=""" & TeamViewerArray_Desc(TeamViewerIDnum.Value) & """></td></tr>"
strHtm = strHtm & "<tr><td width=""150"" class=""caption"">Senha <input type=""button"" class=""showpass"" onclick=""this.value=(textToPassword(this.form['TeamViewerSelectedPassword'])=='text'?'Ocultar':'Mostrar');"" value=""Mostrar""></td><td><input type=""password"" name=""TeamViewerSelectedPassword"" class=""input"" value=""" & Decrypt(TeamViewerArray_Pass(TeamViewerIDnum.Value)) & """ id=""TeamViewerSelectedPassword""></td></tr>"
strHtm = strHtm & "<tr><td width=""150"" class=""caption"">Tipo de Conexão</td><td>"
strHtm = strHtm & "<select name=""tvconntype"" class=""input"">"
strHtm = strHtm & "<option value=""remoteControl""> Controle Remoto"
strHtm = strHtm & "<option value=""presentation""> Apresentação"
strHtm = strHtm & "<option value=""fileTransfer""> Transferência"
strHtm = strHtm & "<option value=""vpn""> Tunel VPN"
strHtm = strHtm & "</select>"
strHtm = strHtm & "</td></tr>"
strHtm = strHtm & "<tr><td width=""150"" class=""caption"">Qualidade</td><td>"
strHtm = strHtm & "<select name=""tvquality"" class=""input"">"
strHtm = strHtm & "<option value=""1""> Automática"
strHtm = strHtm & "<option value=""2""> Priorizar Qualidade"
strHtm = strHtm & "<option value=""3""> Priorizar Velocidade"
strHtm = strHtm & "<option value=""4""> Customizar Opções"
strHtm = strHtm & "</select>"
strHtm = strHtm & "</td></tr>"
strHtm = strHtm & "<tr><td colspan=""2"" align=""center"" height=""2px""></td></tr>"
strHtm = strHtm & "<tr><td colspan=""2"" align=""center"">"
strHtm = strHtm & "<input type=""button"" value=""Conectar"" class=""input-submit"" onclick=""Connection_OnClick()"">"
strHtm = strHtm & " "
strHtm = strHtm & "<input type=""button"" value=""Salvar"" class=""input-submit"" onclick=""Save_OnClick()"">"
strHtm = strHtm & "</td></tr>"
strHtm = strHtm & "</form>"
strHtm = strHtm & "<tr><td colspan=""2"" align=""center"" height=""2px"" bgcolor=""#000000""></td></tr>"
strHtm = strHtm & "<form name=""frmDataDel"">"
strHtm = strHtm & "<input type=""hidden"" name=""TeamViewerDelID"" class=""input"" value=""" & TeamViewerArray_ID(TeamViewerIDnum.Value) & """>"
strHtm = strHtm & "<tr><td colspan=""2"" align=""center"">"
strHtm = strHtm & "<input type=""checkbox"" name=""del001"" onclick=""Disable(this,'delete001')""> Desejo remover este ID: "
strHtm = strHtm & "<input type=""button"" name=""delete001"" value=" & TeamViewerArray_ID(TeamViewerIDnum.Value) & " disabled=""disabled"" class=""input-delete"" onclick=""Delete_OnClick()"">"
strHtm = strHtm & "</td></tr>"
strHtm = strHtm & "</form>"
strHtm = strHtm & "</table>"
end if
dataarea.innerhtml = strHtm
End Sub
Sub Connection_OnClick()
If Len(window.frmData.TeamViewerSelectedPassword.Value) > 0 then
Set wsh = CreateObject("Wscript.Shell")
cmdcommand = "%comspec% /c C: & " & Chr(34) & "C:\Program Files (x86)\TeamViewer\Version8\TeamViewer.exe" & Chr(34) & " -i " & window.frmData.TeamViewerSelectedID.Value & " --Password " & window.frmData.TeamViewerSelectedPassword.Value & " --mode " & window.frmData.tvconntype.Value & " --quality " & window.frmData.tvquality.Value
wsh.Run "" & cmdcommand & "", 0, True
else
Msgbox "Você deve informar uma senha." & Chr(10) & "Esta operação foi cancelada."
Exit Sub
end if
DoLog_OnClick("Conectado" & VBTab & "ID: " & window.frmData.TeamViewerSelectedID.Value & " Senha: " & window.frmData.TeamViewerSelectedPassword.Value & " Modo: " & window.frmData.tvconntype.Value & " Qualidade: " & window.frmData.tvquality.Value)
End Sub
Sub Save_OnClick()
If Len(window.frmData.TeamViewerSelectedID.Value) > 0 then
Dim objOutputFileSave, strOutputFileSave
strOutputFileSave = "TeamViewerManager.db"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objOutputFileSave = objFSO.OpenTextFile(strOutPutFileSave, 2, True)
For y=0 to numberofrowsintvdbtxt
If TeamViewerArray_ID(y) <> window.frmData.TeamViewerSelectedID.Value then
objOutputFileSave.Writeline(TeamViewerArray_ID(y) & VBTab & Encrypt(TeamViewerArray_Pass(y)) & VBTab & TeamViewerArray_Desc(y))
else
objOutputFileSave.Writeline(window.frmData.TeamViewerSelectedID.Value & VBTab & Encrypt(window.frmData.TeamViewerSelectedPassword.Value) & VBTab & window.frmData.TeamViewerSelectedDescription.Value)
end if
Next
objOutputFileSave.Close
MsgBox("TeamViewer ID " & window.frmData.TeamViewerSelectedID.Value & Chr(10) & "foi salvo com sucesso !")
DoLog_OnClick("Atualizado" & VBTab & "ID: " & window.frmData.TeamViewerSelectedID.Value & VBTab & "Descrição: " & window.frmData.TeamViewerSelectedDescription.Value)
Window_ReLoad()
else
MsgBox("Você deve informar um Team Viewer ID")
Exit Sub
end if
End Sub
Sub NewID_OnClick()
strHtms = "<form name=""frmDataSave"">"
strHtms = strHtms & "<table border=""0"" width=""100%"" height=""100%"" valign=""top"">"
strHtms = strHtms & "<tr><td width=""150"" class=""caption"">ID do TeamViewer</td><td><input type=""text"" name=""TeamViewerNewID"" class=""input""></td></tr>"
strHtms = strHtms & "<tr><td width=""150"" class=""caption"">Descrição</td><td><input type=""text"" name=""TeamViewerNewDescription"" class=""input""></td></tr>"
strHtms = strHtms & "<tr><td width=""150"" class=""caption"">Senha</td><td><input type=""text"" name=""TeamViewerNewPassword"" class=""input""></td></tr>"
strHtms = strHtms & "<tr><td colspan=""2"" align=""center""> </td></tr>"
strHtms = strHtms & "<tr><td colspan=""2"" align=""center"">"
strHtms = strHtms & "<input type=""button"" value=""Salvar"" class=""input-submit"" onclick=""SaveNew_OnClick()"">"
strHtms = strHtms & "</td></tr>"
strHtms = strHtms & "</table>"
strHtms = strHtms & "</form>"
dataarea.innerhtml = strHtms
end sub
Sub SaveNew_OnClick()
If Len(window.frmDataSave.TeamViewerNewID.Value) > 0 then
strOutputFile = "TeamViewerManager.db"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objOutputFile = objFSO.OpenTextFile(strOutPutFile, 8, True)
objOutputFile.Writeline(window.frmDataSave.TeamViewerNewID.Value & VBTab & Encrypt(window.frmDataSave.TeamViewerNewPassword.Value) & VBTab & window.frmDataSave.TeamViewerNewDescription.Value)
objOutputFile.Close
DoLog_OnClick("Adicionado" & VBTab & "ID: " & window.frmDataSave.TeamViewerNewID.Value & VBTab & "Descrição: " & window.frmDataSave.TeamViewerNewDescription.Value)
MsgBox("TeamViewer ID " & window.frmDataSave.TeamViewerNewID.Value & Chr(10) & "foi salvo com sucesso !")
Window_ReLoad()
else
MsgBox("Você deve informar um Team Viewer ID")
Exit Sub
end if
end sub
Sub Delete_OnClick()
Dim objOutputFileDel, strOutputFileDel
strOutputFileDel = "TeamViewerManager.db"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objOutputFileDel = objFSO.OpenTextFile(strOutPutFileDel, 2, True)
For m=0 to numberofrowsintvdbtxt
If TeamViewerArray_ID(m) <> window.frmDataDel.TeamViewerDelID.Value then
objOutputFileDel.Writeline(TeamViewerArray_ID(m) & VBTab & Encrypt(TeamViewerArray_Pass(m)) & VBTab & TeamViewerArray_Desc(m))
end if
Next
objOutputFileDel.Close
DoLog_OnClick("Removido" & VBTab & "ID: " & window.frmDataDel.TeamViewerDelID.Value)
MsgBox("TeamViewer ID " & window.frmDataDel.TeamViewerDelID.Value & Chr(10) & "foi removido com sucesso !")
Window_ReLoad()
End Sub
Sub Window_ReLoad()
Location.Reload(True)
End Sub
Function DoLog_OnClick(log_parameter)
strOutputFileLog = "TeamViewerManager.log"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objOutputFileLog = objFSO.OpenTextFile(strOutPutFileLog, 8, True)
objOutputFileLog.Writeline( CurrentTimeStamp & VBTab & log_parameter)
objOutputFileLog.Close
end Function
Private Function Decrypt(ByVal encryptedstring)
Dim x, i, tmp
encryptedstring = StrReverse( encryptedstring )
For i = 1 To Len( encryptedstring )
x = Mid( encryptedstring, i, 1 )
tmp = tmp & Chr( Asc( x ) - 1 )
Next
Decrypt = tmp
End Function
Private Function Encrypt(ByVal string)
Dim x, i, tmp
For i = 1 To Len( string )
x = Mid( string, i, 1 )
tmp = tmp & Chr( Asc( x ) + 1 )
Next
tmp = StrReverse( tmp )
Encrypt = tmp
End Function
</script>
</body>
</html>
Download em anexo.
Bom proveito