# Creates .lnk files (with admin rights if desired), can execute any file in hidden mode (no more bothersome popups when executing .bat/.cmd files)
## 1. Installing
This tool creates .lnk files either from python or your shell (cmd.exe)
It is possible to create .lnk files with "Run as Administrator" checked.
You can also execute every executable file in hidden mode (no window, no icon in the taskbar), no bothersome popup when opening bat files.
However, it is still possible to capture the stdout.
```python
pip install lnkgonewild
```
```python
# install nuitka! https://github.com/Nuitka/Nuitka
from lnkgonewild import lnkcompile # import to compile
# The command line that was created and executed to compile secretsubprocess.exe
# output:
# start "" "C:\ProgramData\anaconda3\envs\adda\python.exe" -m nuitka C:/ProgramData/anaconda3/envs/adda/lib/site-packages/lnkgonewild/secretsubprocess.py --standalone --assume-yes-for-downloads --windows-disable-console --onefile --windows-uac-admin --file-version=0.1 --clean-cache=all
# When you see this messsage, please wait until the first compilation has finished.
Wait until the subprocess is done! Press enter to continue>?
# The command line that was created and executed to compile lnkgonewild.exe
# output:
# start "" "C:\ProgramData\anaconda3\envs\adda\python.exe" -m nuitka C:/ProgramData/anaconda3/envs/adda/lib/site-packages/lnkgonewild/lnkgonewild.py --standalone --assume-yes-for-downloads --onefile --include-data-files=C:/Users/hansc/AppData/Local/Temp/tmpaz6c5xsy=.//=**/*.* --windows-uac-admin --file-version=0.1 --onefile-tempdir-spec=%CACHE_DIR%/lnkgonewild/0.1 --clean-cache=all --jobs=4
# https://github.com/hansalemaos/lnkgonewild/raw/main/1.png
```
![](https://github.com/hansalemaos/lnkgonewild/blob/main/1.png?raw=true)
The compiled files can also be downloaded (Python is not needed):
https://github.com/hansalemaos/lnkgonewild/raw/main/lnkgonewild.exe
https://github.com/hansalemaos/lnkgonewild/raw/main/secretsubprocess.exe
## Warnings
#### Due to the app's suspicious behavior (changing bytes in .lnk files, executing other processes as subprocesses, hiding windows, capturing output, containing exe in exe files (secretsubprocess.exe is in lnkgonewild.exe, writing scripts to the HDD and executing them), you might have to add those files as exceptions to your antivirus.
![](https://github.com/hansalemaos/lnkgonewild/blob/main/5.png?raw=true)
![](https://github.com/hansalemaos/lnkgonewild/blob/main/6.png?raw=true)
## 3. Creating “common” shortcuts
![](https://github.com/hansalemaos/lnkgonewild/blob/main/2.png?raw=true)
```python
from lnkgonewild.lnkgonewild import create_shortcut
# stdout can't be captured when minimized_maximized_normal_invisible!='invisible'
create_shortcut(
shortcut_path=r"C:\Users\hansc\Desktop\testlnk2.lnk",
target=r"C:\cygwin\bin\ls.exe",
arguments=[r"-la"],
working_dir="c:\\Windows\\Fonts",
minimized_maximized_normal_invisible="normal", #
silentlog=None, # stdout can be written to file if the process is invisible
asadmin=False, # enables the admin check box
hotkey="Ctrl+Alt+q",
)
# The JS that created the link
var sh = WScript.CreateObject("WScript.Shell");
var shortcut = sh.CreateShortcut("C:\\Users\\hansc\\Desktop\\testlnk2.lnk");
shortcut.WindowStyle = 4;
shortcut.TargetPath = "C:\\cygwin\\bin\\ls.exe";
shortcut.Hotkey = "Ctrl+Alt+q";
shortcut.Arguments = "-la";
shortcut.WorkingDirectory = "c:\\Windows\\Fonts";
shortcut.IconLocation = "C:\\cygwin\\bin\\ls.exe";
shortcut.Save();
```
![](https://github.com/hansalemaos/lnkgonewild/blob/main/3.png?raw=true)
![](https://github.com/hansalemaos/lnkgonewild/blob/main/4.png?raw=true)
## 4. Creating “special” shortcuts (hidden execution)
```python
# If you pass minimized_maximized_normal_invisible="invisible"
# the window/console will be hidden, but stdout can be captured
# if secretsubprocess.exe is missing, the function will ask to compile it.
# You need https://github.com/Nuitka/Nuitka for the compilation
# If a hidden process gets stuck, you can kill it using the task manager
create_shortcut(
shortcut_path=r"C:\Users\hansc\Desktop\testlnk3.lnk",
target=r"C:\cygwin\bin\ls.exe",
arguments=[r"-la" ,"-R"],
working_dir="c:\\Windows\\System32",
minimized_maximized_normal_invisible="invisible", # secretsubprocess.exe is necessary
silentlog="c:\\logfilels22.txt", # stdout can be written to file if the process is invisible
asadmin=True, # enables the admin check box by changing some bytes in the .lnk file
hotkey="Ctrl+Alt+e",
)
# The JS that created the link secretsubprocess.exe takes care of the process and hides everything
var sh = WScript.CreateObject("WScript.Shell");
var shortcut = sh.CreateShortcut("C:\\Users\\hansc\\Desktop\\testlnk3.lnk");
shortcut.WindowStyle = 4;
shortcut.Hotkey = "Ctrl+Alt+e" ;
shortcut.TargetPath = "C:\\ProgramData\\anaconda3\\envs\\adda\\lib\\site-packages\\lnkgonewild\\secretsubprocess.exe";
shortcut.Arguments = "--exe C:\\cygwin\\bin\\ls.exe --log c:\\logfilels22.txt --args -la -R";
shortcut.WorkingDirectory = "c:\\Windows\\System32";
shortcut.IconLocation = "C:\\ProgramData\\anaconda3\\envs\\adda\\lib\\site-packages\\lnkgonewild\\secretsubprocess.exe";
shortcut.Save();
# lnkgonewild can also be used as a command line tool to create links
# usage: lnkgonewild.exe [-h] [--shortcut_path SHORTCUT_PATH] [--target TARGET] [--hotkey HOTKEY] [--working_dir WORKING_DIR] [--mode MODE] [--silentlog SILENTLOG] [--asadmin ASADMIN] [--args ARGS]
#
# options:
# -h, --help show this help message and exit
# --shortcut_path SHORTCUT_PATH The path where the shortcut file will be created.
# --target TARGET The path to the target file or application that the shortcut will launch.
# --hotkey HOTKEY Hotkey for opening the lnk file. Defaults to ''.
# --working_dir WORKING_DIR The working directory for the target file or application. (Working dict of shortcut_path).
# --mode MODE The window state of the target application when launched. Can be "normal", "minimized", "maximized", or "invisible".
# --silentlog SILENTLOG The path to a log file for the target application when minimized_maximized_normal_invisible == "invisible".
# --asadmin ASADMIN Whether to run the shortcut as an administrator. Defaults to False.
# --args ARGS Arguments to be passed to the target file or application as they would receive them. Example: lnkgonewild.exe --shortcut_path C:\Users\hansc\Desktop\testlink.lnk --target C:\cygwin\bin\lsattr.exe
# --hotkey Ctrl+Alt+q --working_dir None --mode minimized --silentlog None --asadmin False --arguments -a -d
# --mode invisible -> window is hidden, stdout can be captured
# lnkgonewild --shortcut_path C:\Users\hansc\Desktop\dirlist.lnk --target C:\cygwin\bin\ls.exe --hotkey Ctrl+Alt+e --working_dir C:\Windows\Branding --mode invisible --silentlog c:\diroutputcap3.txt --asadmin True --args -la
# --mode normal -> windows is shown, stdout can't be captured
# lnkgonewild --shortcut_path C:\Users\hansc\Desktop\dirlist.lnk --target C:\cygwin\bin\ls.exe --hotkey Ctrl+Alt+e --working_dir C:\Windows\Branding --mode normal --silentlog c:\diroutputcap3.txt --asadmin True --args -la -R
# If you want to capture the stdout without secretsubprocess.exe, you can do something like that:
# Create a bat file:
# cd c:\Windows\System32
# dir /b/s > c:\dirlistoutput.txt
# lnkgonewild.exe --shortcut_path C:\Users\hansc\Desktop\testbat.lnk --target C:\Users\hansc\Desktop\listdir.bat --hotkey Ctrl+Alt+i --working_dir None --mode minimized --silentlog None --asadmin False
```
Raw data
{
"_id": null,
"home_page": "https://github.com/hansalemaos/lnkgonewild",
"name": "lnkgonewild",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "hidden,subprocess,windows,lnk,links,shortcuts",
"author": "Johannes Fischer",
"author_email": "<aulasparticularesdealemaosp@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/bd/e9/dfedd49198df96adddca6f8d00d31657e21964ccfb4b365838a86c02b83f/lnkgonewild-0.10.tar.gz",
"platform": null,
"description": "\r\n# Creates .lnk files (with admin rights if desired), can execute any file in hidden mode (no more bothersome popups when executing .bat/.cmd files)\r\n\r\n## 1. Installing \r\n\r\nThis tool creates .lnk files either from python or your shell (cmd.exe) \r\nIt is possible to create .lnk files with \"Run as Administrator\" checked.\r\n\r\nYou can also execute every executable file in hidden mode (no window, no icon in the taskbar), no bothersome popup when opening bat files.\r\nHowever, it is still possible to capture the stdout.\r\n\r\n```python\r\npip install lnkgonewild\r\n```\r\n\r\n```python\r\n# install nuitka! https://github.com/Nuitka/Nuitka\r\n\r\n\r\nfrom lnkgonewild import lnkcompile # import to compile\r\n\r\n# The command line that was created and executed to compile secretsubprocess.exe\r\n# output:\r\n# start \"\" \"C:\\ProgramData\\anaconda3\\envs\\adda\\python.exe\" -m nuitka C:/ProgramData/anaconda3/envs/adda/lib/site-packages/lnkgonewild/secretsubprocess.py --standalone --assume-yes-for-downloads --windows-disable-console --onefile --windows-uac-admin --file-version=0.1 --clean-cache=all\r\n\r\n# When you see this messsage, please wait until the first compilation has finished. \r\nWait until the subprocess is done! Press enter to continue>? \r\n\r\n# The command line that was created and executed to compile lnkgonewild.exe\r\n# output:\r\n# start \"\" \"C:\\ProgramData\\anaconda3\\envs\\adda\\python.exe\" -m nuitka C:/ProgramData/anaconda3/envs/adda/lib/site-packages/lnkgonewild/lnkgonewild.py --standalone --assume-yes-for-downloads --onefile --include-data-files=C:/Users/hansc/AppData/Local/Temp/tmpaz6c5xsy=.//=**/*.* --windows-uac-admin --file-version=0.1 --onefile-tempdir-spec=%CACHE_DIR%/lnkgonewild/0.1 --clean-cache=all --jobs=4\r\n# https://github.com/hansalemaos/lnkgonewild/raw/main/1.png\r\n```\r\n\r\n![](https://github.com/hansalemaos/lnkgonewild/blob/main/1.png?raw=true)\r\n\r\nThe compiled files can also be downloaded (Python is not needed):\r\nhttps://github.com/hansalemaos/lnkgonewild/raw/main/lnkgonewild.exe\r\nhttps://github.com/hansalemaos/lnkgonewild/raw/main/secretsubprocess.exe\r\n\r\n## Warnings\r\n\r\n#### Due to the app's suspicious behavior (changing bytes in .lnk files, executing other processes as subprocesses, hiding windows, capturing output, containing exe in exe files (secretsubprocess.exe is in lnkgonewild.exe, writing scripts to the HDD and executing them), you might have to add those files as exceptions to your antivirus.\r\n\r\n![](https://github.com/hansalemaos/lnkgonewild/blob/main/5.png?raw=true)\r\n\r\n![](https://github.com/hansalemaos/lnkgonewild/blob/main/6.png?raw=true)\r\n\r\n\r\n## 3. Creating \u201ccommon\u201d shortcuts \r\n\r\n\r\n![](https://github.com/hansalemaos/lnkgonewild/blob/main/2.png?raw=true)\r\n\r\n```python\r\nfrom lnkgonewild.lnkgonewild import create_shortcut\r\n\r\n# stdout can't be captured when minimized_maximized_normal_invisible!='invisible'\r\n\r\n\r\ncreate_shortcut(\r\n shortcut_path=r\"C:\\Users\\hansc\\Desktop\\testlnk2.lnk\",\r\n target=r\"C:\\cygwin\\bin\\ls.exe\",\r\n arguments=[r\"-la\"],\r\n working_dir=\"c:\\\\Windows\\\\Fonts\",\r\n minimized_maximized_normal_invisible=\"normal\", #\r\n silentlog=None, # stdout can be written to file if the process is invisible\r\n asadmin=False, # enables the admin check box\r\n hotkey=\"Ctrl+Alt+q\",\r\n)\r\n\r\n# The JS that created the link \r\nvar sh = WScript.CreateObject(\"WScript.Shell\");\r\nvar shortcut = sh.CreateShortcut(\"C:\\\\Users\\\\hansc\\\\Desktop\\\\testlnk2.lnk\");\r\nshortcut.WindowStyle = 4;\r\nshortcut.TargetPath = \"C:\\\\cygwin\\\\bin\\\\ls.exe\";\r\nshortcut.Hotkey = \"Ctrl+Alt+q\";\r\nshortcut.Arguments = \"-la\";\r\nshortcut.WorkingDirectory = \"c:\\\\Windows\\\\Fonts\";\r\nshortcut.IconLocation = \"C:\\\\cygwin\\\\bin\\\\ls.exe\";\r\nshortcut.Save();\r\n```\r\n\r\n![](https://github.com/hansalemaos/lnkgonewild/blob/main/3.png?raw=true)\r\n\r\n\r\n![](https://github.com/hansalemaos/lnkgonewild/blob/main/4.png?raw=true)\r\n\r\n\r\n## 4. Creating \u201cspecial\u201d shortcuts (hidden execution)\r\n\r\n\r\n```python\r\n# If you pass minimized_maximized_normal_invisible=\"invisible\"\r\n# the window/console will be hidden, but stdout can be captured\r\n# if secretsubprocess.exe is missing, the function will ask to compile it.\r\n# You need https://github.com/Nuitka/Nuitka for the compilation\r\n# If a hidden process gets stuck, you can kill it using the task manager\r\n\r\ncreate_shortcut(\r\n shortcut_path=r\"C:\\Users\\hansc\\Desktop\\testlnk3.lnk\",\r\n target=r\"C:\\cygwin\\bin\\ls.exe\",\r\n arguments=[r\"-la\" ,\"-R\"],\r\n working_dir=\"c:\\\\Windows\\\\System32\",\r\n minimized_maximized_normal_invisible=\"invisible\", # secretsubprocess.exe is necessary\r\n silentlog=\"c:\\\\logfilels22.txt\", # stdout can be written to file if the process is invisible\r\n asadmin=True, # enables the admin check box by changing some bytes in the .lnk file\r\n hotkey=\"Ctrl+Alt+e\",\r\n)\r\n\r\n# The JS that created the link secretsubprocess.exe takes care of the process and hides everything\r\nvar sh = WScript.CreateObject(\"WScript.Shell\");\r\nvar shortcut = sh.CreateShortcut(\"C:\\\\Users\\\\hansc\\\\Desktop\\\\testlnk3.lnk\");\r\nshortcut.WindowStyle = 4;\r\nshortcut.Hotkey = \"Ctrl+Alt+e\" ;\r\nshortcut.TargetPath = \"C:\\\\ProgramData\\\\anaconda3\\\\envs\\\\adda\\\\lib\\\\site-packages\\\\lnkgonewild\\\\secretsubprocess.exe\";\r\nshortcut.Arguments = \"--exe C:\\\\cygwin\\\\bin\\\\ls.exe --log c:\\\\logfilels22.txt --args -la -R\";\r\nshortcut.WorkingDirectory = \"c:\\\\Windows\\\\System32\";\r\nshortcut.IconLocation = \"C:\\\\ProgramData\\\\anaconda3\\\\envs\\\\adda\\\\lib\\\\site-packages\\\\lnkgonewild\\\\secretsubprocess.exe\";\r\nshortcut.Save();\r\n \r\n# lnkgonewild can also be used as a command line tool to create links\r\n\r\n# usage: lnkgonewild.exe [-h] [--shortcut_path SHORTCUT_PATH] [--target TARGET] [--hotkey HOTKEY] [--working_dir WORKING_DIR] [--mode MODE] [--silentlog SILENTLOG] [--asadmin ASADMIN] [--args ARGS]\r\n#\r\n# options:\r\n# -h, --help show this help message and exit\r\n# --shortcut_path SHORTCUT_PATH The path where the shortcut file will be created.\r\n# --target TARGET The path to the target file or application that the shortcut will launch.\r\n# --hotkey HOTKEY Hotkey for opening the lnk file. Defaults to ''.\r\n# --working_dir WORKING_DIR The working directory for the target file or application. (Working dict of shortcut_path).\r\n# --mode MODE The window state of the target application when launched. Can be \"normal\", \"minimized\", \"maximized\", or \"invisible\".\r\n# --silentlog SILENTLOG The path to a log file for the target application when minimized_maximized_normal_invisible == \"invisible\".\r\n# --asadmin ASADMIN Whether to run the shortcut as an administrator. Defaults to False.\r\n# --args ARGS Arguments to be passed to the target file or application as they would receive them. Example: lnkgonewild.exe --shortcut_path C:\\Users\\hansc\\Desktop\\testlink.lnk --target C:\\cygwin\\bin\\lsattr.exe\r\n# --hotkey Ctrl+Alt+q --working_dir None --mode minimized --silentlog None --asadmin False --arguments -a -d\r\n\r\n\r\n# --mode invisible -> window is hidden, stdout can be captured\r\n# lnkgonewild --shortcut_path C:\\Users\\hansc\\Desktop\\dirlist.lnk --target C:\\cygwin\\bin\\ls.exe --hotkey Ctrl+Alt+e --working_dir C:\\Windows\\Branding --mode invisible --silentlog c:\\diroutputcap3.txt --asadmin True --args -la\r\n# --mode normal -> windows is shown, stdout can't be captured\r\n# lnkgonewild --shortcut_path C:\\Users\\hansc\\Desktop\\dirlist.lnk --target C:\\cygwin\\bin\\ls.exe --hotkey Ctrl+Alt+e --working_dir C:\\Windows\\Branding --mode normal --silentlog c:\\diroutputcap3.txt --asadmin True --args -la -R\r\n\r\n# If you want to capture the stdout without secretsubprocess.exe, you can do something like that:\r\n# Create a bat file:\r\n# cd c:\\Windows\\System32\r\n# dir /b/s > c:\\dirlistoutput.txt\r\n\r\n# lnkgonewild.exe --shortcut_path C:\\Users\\hansc\\Desktop\\testbat.lnk --target C:\\Users\\hansc\\Desktop\\listdir.bat --hotkey Ctrl+Alt+i --working_dir None --mode minimized --silentlog None --asadmin False\r\n```\r\n\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Creates .lnk files (with admin rights if desired), can execute any file in hidden mode (no more bothersome popups when executing .bat/.cmd files)",
"version": "0.10",
"split_keywords": [
"hidden",
"subprocess",
"windows",
"lnk",
"links",
"shortcuts"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "ec474318a73e38763ca03c8613725de5d1037d6786eaf7549c2f9289c27dbc2f",
"md5": "4985481bdf2563fe70fcdcbd61aca5fc",
"sha256": "f7f68c5c28123f13928bd123793967d0d44466f9576cda598141c40f3e3c3b4d"
},
"downloads": -1,
"filename": "lnkgonewild-0.10-py3-none-any.whl",
"has_sig": false,
"md5_digest": "4985481bdf2563fe70fcdcbd61aca5fc",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 13836,
"upload_time": "2023-04-09T16:21:04",
"upload_time_iso_8601": "2023-04-09T16:21:04.641296Z",
"url": "https://files.pythonhosted.org/packages/ec/47/4318a73e38763ca03c8613725de5d1037d6786eaf7549c2f9289c27dbc2f/lnkgonewild-0.10-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "bde9dfedd49198df96adddca6f8d00d31657e21964ccfb4b365838a86c02b83f",
"md5": "901d26e479191c9aeef56eac1905ad9c",
"sha256": "4267d2949b5e428a6c4c62cc9db1a605ba0835cac38607ec750c3f9b1b6522d0"
},
"downloads": -1,
"filename": "lnkgonewild-0.10.tar.gz",
"has_sig": false,
"md5_digest": "901d26e479191c9aeef56eac1905ad9c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 11680,
"upload_time": "2023-04-09T16:21:06",
"upload_time_iso_8601": "2023-04-09T16:21:06.837968Z",
"url": "https://files.pythonhosted.org/packages/bd/e9/dfedd49198df96adddca6f8d00d31657e21964ccfb4b365838a86c02b83f/lnkgonewild-0.10.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-04-09 16:21:06",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "hansalemaos",
"github_project": "lnkgonewild",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "lnkgonewild"
}