Skip to content

Instantly share code, notes, and snippets.

@0m3r
Last active April 6, 2020 10:10
Show Gist options
  • Save 0m3r/18ec1dffd81855d1c358a28a77f23d78 to your computer and use it in GitHub Desktop.
Save 0m3r/18ec1dffd81855d1c358a28a77f23d78 to your computer and use it in GitHub Desktop.
find FTP credentials in basecamp ticket and paste into Filezilla
  1. Open your basecamp ticket
  2. open js console and run this js code in console
    var text = jQuery('.formatted_content').eq(0).text();

    var startr = "(^|<div>|<br>)\\s*";
    var delimiterr = "(\\s|&nbsp;)*[:-]*(\\s|&nbsp;)*";
    var endr = "\\s*($|&nbsp;|<\/div>|<br>)";

    var rhost     = new RegExp(startr + "(host|domain|server)+" + delimiterr + "([a-z0-9.]{3,})" + endr, "img");
    var ruser     = new RegExp(startr + "(user|username|login)" + delimiterr + "([a-zA-Z0-9\\-@.]{3,})" + endr, "img");
    var rpassword = new RegExp(startr + "pass(word)*" + delimiterr + "([A-Za-z\\d@$!%*#?&)(]{4,})" + endr, "img");
    var rpath     = new RegExp(startr + "(path|dir)+" + delimiterr + "([~\\.A-Za-z\\d-\\/\\\\]{3,})" + endr, "img");
    var rport     = new RegExp(startr + "(ssh|ftp)*\s*port" + delimiterr + "(\\d+)" + endr, "img");

    if (text.match(rhost) === null) {
        text = jQuery('.formatted_content').eq(0).html();
    }

    var hosts = [];
    text.match(rhost) && text.match(rhost).forEach(function(host){
        hosts.push(host.replace(rhost, "$5"));
    });
    console.log(hosts);

    var usernames = [];
    text.match(ruser) && text.match(ruser).forEach(function(username){
        usernames.push(username.replace(ruser, "$5"));
    });
    console.log(usernames);

    var passwords = [];
    text.match(rpassword) && text.match(rpassword).forEach(function(password){
        passwords.push(password.replace(rpassword, "$5"));
    });
    console.log(passwords);

    var path = '';
    text.match(rpath) && text.match(rpath).forEach(function(tpath){
        path = tpath.replace(rpath, "$5");
    });
    console.log(path);

    var port = '';
    text.match(rport) && text.match(rport).forEach(function(tport) {
        port = tport.replace(rport, "$5");
    });
    console.log(port);


    console.log('sftp://' +
        usernames.slice(-1).pop() + ':' +
        passwords.slice(-1).pop() + '@' +
        hosts.slice(-1).pop() +
        (port ? ':' + port : '') +
        (path ? '/' + path : '')
    );
    
    console.log('ssh ' +
        usernames.slice(-1).pop() + '@' +
        hosts.slice(-1).pop() +
        (port ? '-p ' + port : '')
    );

2.You can paste a URL to Host box on Quickconnect bar. Once you click Quickconnect button, the URL is parsed into Host, Username, Password and Port.

docs ftp://ftp.funet.fi/pub/standards/RFC/rfc959.txt https://superuser.com/questions/1378298/how-to-use-ftp-link-url-with-filezilla

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment