3D Clipboard

A place to discuss 3D Clipboard

Tiny FTP URL password manager from Clipboard

Share actions you've created here.
julien
Posts: 5
Joined: Wed Mar 30, 2016 11:20 am

Tiny FTP URL password manager from Clipboard

Postby julien » Wed Mar 30, 2016 11:41 am

Hi,

Use of VBScript burns my eyes and my fingers but I made this as I am dealing with FTP links all the day.

FileZilla is currently my FTP client under Windows and I did not find time to add this feature, in the right-click menu, yet: copy FTP URL from of a file including the stored FTP password (and yes, I know how unsecure this is).

So workaround is this great tool 3CDlipboard.

Code: Select all

Rem Replace value bellow by your *exact* script name:
ScriptName="FTP password manager"

reg = "HKEY_CURRENT_USER\Software\Vince Valenti\3D Clipboard\Actions\"+ScriptName

Set r = New regexp
r.Pattern = "^ftp://([^:@/]+(:[^:@/]+)[email protected])?([^@/]+)(/.*)$"
Set m = r.Execute(Clipboard.Value)

If m.Count = 1 Then
  Set ma = m(0)
  Set sh = CreateObject("WScript.Shell")
 
  Rem Normaly we should use "Select Case ma.SubMatches.Count"
  Rem But VB does not handles properly capture parenthesis and SubMatches will always return 4

  U = ma.SubMatches(0)
  P = ma.SubMatches(1)
  S = ma.SubMatches(2)
  R = ma.SubMatches(3)

  If U <> "" Then
    Rem Remove '@'
    U = Left(U, Len(U)-1)
  Else
    U = InputBox("Username for "& S & ":")
  End If
  If P <> "" Then
    Rem Remove Password from U
    U = Left(U, Len(U)-Len(P))
    Rem Remove ':'
    P = Right(P, Len(P)-1)
  End If
 
  ID = U & "@" & S

  on error resume Next
  If P = "" Then
    P = sh.RegRead (reg & "\" & ID)
    If Err.Number <> 0 Then
      Err.Clear
      P = InputBox("Password for "& ID & ":")
      If P <> "" Then
        sh.RegWrite reg & "\" & ID, P, "REG_SZ"
      End If
    End If
  Else
    Q = sh.RegRead (reg & "\" & ID)
    If Err.Number <> 0 Then
      Err.Clear
      MsgBox "Password for" & ID & "stored!"
      sh.RegWrite reg & "\" & ID, P, "REG_SZ"
    ElseIf P <> Q Then
      If MsgBox ("Password for " & ID & " seems to have changed." & chr(13) & "Do you want to update the stored password?", vbYesNo + vbQuestion, "Password update") = vbYes Then
        sh.RegWrite reg & "\" & ID, P, "REG_SZ"
      End If
    End If
  End If

  If U <> "" and P <> "" Then
    Clipboard.Value = "ftp://" & U & ":" & P & "@" & S & R
  ElseIf U <> "" Then
    Clipboard.Value = "ftp://" & U & "@" & S & R
  End If
End If


Download file:
Tiny FTP URL password manager.zip
(988 Bytes) Downloaded 225 times


Cheers,
Julien

julien
Posts: 5
Joined: Wed Mar 30, 2016 11:20 am

Re: Tiny FTP URL password manager from Clipboard

Postby julien » Wed May 04, 2016 11:05 pm

Hi,

I finally prepared a patch to have this functionality directly included in FileZilla client:
https://trac.filezilla-project.org/ticket/10829

Wait and see...

Julien


Return to “Actions”

 

 

cron