Compare commits
22 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1470cc8f43 | ||
|
|
12da359803 | ||
|
|
a0e8557d6d | ||
|
|
9dd19e1486 | ||
|
|
61352ce2c1 | ||
|
|
a6f4fedf63 | ||
|
|
2c63f7380b | ||
|
|
48a7a8b922 | ||
|
|
19dcd4564b | ||
|
|
2fd45e793e | ||
|
|
a24db673f7 | ||
|
|
a1937e776b | ||
|
|
b0e1c49399 | ||
|
|
69a111eedc | ||
|
|
19bf5b2789 | ||
|
|
1c1a4d1310 | ||
|
|
bf6e9b7fbf | ||
|
|
2f3339b1ab | ||
|
|
b8f82b6df6 | ||
|
|
77651b3a3b | ||
|
|
d1eb473c1a | ||
|
|
45627f39c3 |
42
CHANGELOG.md
42
CHANGELOG.md
@@ -1,43 +1,61 @@
|
||||
# Changelog for ishare2
|
||||
|
||||
All notable changes to this project will be documented in this file. You can upgrade ishare2 to the latest version using `ishare2 upgrade` and then selecting `option 1`
|
||||
|
||||
## [v1.7.2] - 2023-Feb-12
|
||||
|
||||
1) Added: `--overwrite` flag. Users can specify they want to overwrite an image by passing this 4th argument. Useful when download gets interrupted or you want to restore it to the initial state. Syntax: `ishare pull <type> <id> --overwrite`
|
||||
|
||||
## [v1.7.1] - 2023-Feb-08
|
||||
|
||||
1) Modified: Minor changes were made in the check_user_is_root() function in order to be more precise on user privileges when executing ishare2
|
||||
|
||||
## [v1.7.0] - 2023-Feb-04
|
||||
|
||||
1) Modified: About `ishare2 upgrade` > `option 2`: Now, there are 2 stable versions of PNETLab available to use. Other releases were BETA type and they are not available anymore
|
||||
|
||||
## [v1.6.9] - 2023-Feb-04
|
||||
1) Modified: PNETLab version 5.3.11 changed state from BETA to STABLE. This upgrade can be implemented using this command: `ishare2 upgrade` > `option 2` and selecting the correspondant option
|
||||
|
||||
1) Modified: PNETLab version 5.3.11 changed state from BETA to STABLE. This upgrade can be implemented using this command: `ishare2 upgrade` > `option 2` and selecting the correspondant option
|
||||
|
||||
## [v1.6.8] - 2023-Feb-03
|
||||
|
||||
1) Added: A new option was added to `ishare2 upgrade` > `option 2`: Now, it is possible to upgrade PNETLab from almost any version to v5.3.11 (Not possible for this case: 6.x to 5.3.11)
|
||||
|
||||
## [v1.6.7] - 2023-Feb-03
|
||||
|
||||
1) Added: A new option was added to `ishare2 upgrade` > `option 2`: Now, it is possible to upgrade PNETLab from almost any version to v5.3.10 (Not possible for this case: 6.x to 5.3.10)
|
||||
|
||||
## [v1.6.6] - 2023-Feb-02
|
||||
|
||||
1) Added: A new option was added to `ishare2 upgrade` > `option 2`: Now, it is possible to upgrade PNETLab from almost any version to v5.3.8 (Not possible for this case: 6.x to 5.3.8)
|
||||
|
||||
## [v1.6.5] - 2023-Feb-02
|
||||
|
||||
1) Added: Now, menu `ishare2 upgrade` > `option 2` displays a message next to each version to distinguish between the STABLE and BETA versions of PNETLab
|
||||
|
||||
## [v1.6.4] - 2023-Feb-02
|
||||
|
||||
1) Added: A new option was added to `ishare2 upgrade` > `option 2`: Now, it is possible to upgrade PNETLab from almost any version to v5.3.7 (Not possible for this case: 6.x to 5.3.7)
|
||||
|
||||
## [v1.6.3] - 2023-Jan-31
|
||||
|
||||
1) Added: A new option was added to `ishare2 upgrade` > `option 2`: Now, it is possible to upgrade PNETLab from almost any version to v5.3.5 (Not possible for this case: 6.x to 5.3.5)
|
||||
|
||||
## [v1.6.2] - 2023-Jan-31
|
||||
|
||||
1) Added: A new option was added to `ishare2 upgrade` > `option 2`: Now, it is possible to upgrade PNETLab from almost any version to v5.3.4 (Not possible for this case: 6.x to 5.3.4)
|
||||
|
||||
## [v1.6.1] - 2023-Jan-30
|
||||
|
||||
1) Added: Some instructions were added to `ishare2_gui_download()` function in order to avoid some errors related to missing packages (pip install uvicorn, pip install fastapi and pip install jinja2 instructions were added)
|
||||
|
||||
## [v1.6.0] - 2023-Jan-30
|
||||
|
||||
1) Added: Command `ishare2 gui stop` was added into `ishare2_gui_download()` function in order to avoid errors when downloading/upgrading ishare2 GUI
|
||||
|
||||
## [v1.5.9] - 2023-Jan-30
|
||||
|
||||
1) Added: A new version control was added for ishare2 GUI. It can be seen using the `ishare2` command and looking at the bottom of it. New functions and variables were implemented. Also, using `ishare2 upgrade` > `option 3` it is possible to upgrade it.
|
||||
|
||||
## [v1.5.8] - 2023-Jan-29
|
||||
@@ -45,7 +63,8 @@ All notable changes to this project will be documented in this file. You can upg
|
||||
1) Added: A new option was added to `ishare2 upgrade` > `option 2`: Now, it is possible to upgrade PNETLab from almost any version to v5.3.2 (Not possible for this case: 6.x to 5.3.2)
|
||||
|
||||
## [v1.5.7] - 2023-Jan-27
|
||||
1) Added: A new feature has been added to ishare2: It is a web app to use ishare2 in browser and it is called `ishare2 GUI`. You can download it by using `ishare2 gui download` and then start it with `ishare2 gui start`. Open your web browser using http://localhost:5000, http://127.0.01:5000 or http://pnetlab_ip_address:5000 to access. Also, it can be stopped by using `ishare2 gui stop` and restarted with `ishare2 gui restart`
|
||||
|
||||
1) Added: A new feature has been added to ishare2: It is a web app to use ishare2 in browser and it is called `ishare2 GUI`. You can download it by using `ishare2 gui download` and then start it with `ishare2 gui start`. Open your web browser using <http://localhost:5000>, <http://127.0.01:5000> or <http://pnetlab_ip_address:5000> to access. Also, it can be stopped by using `ishare2 gui stop` and restarted with `ishare2 gui restart`
|
||||
|
||||
## [v1.5.6] - 2023-Jan-25
|
||||
|
||||
@@ -91,12 +110,12 @@ All notable changes to this project will be documented in this file. You can upg
|
||||
|
||||
## [v1.4.7] - 2023-Jan-16
|
||||
|
||||
1) Added: A function called set_url_constants() was added to the code and to the main() execution. This function contains all of the URL needed in the project.
|
||||
1) Added: A function called set_url_constants() was added to the code and to the main() execution. This function contains all of the URL needed in the project.
|
||||
2) Modified: Function called set_color_variables() was renamed to set_color_constants()
|
||||
|
||||
## [v1.4.6] - 2023-Jan-16
|
||||
|
||||
1) Modified: Minor changes in code: A function called set_color_variables() was created to define all color variables in there. Added to main() execution
|
||||
1) Modified: Minor changes in code: A function called set_color_variables() was created to define all color variables in there. Added to main() execution
|
||||
2) Deleted: Minor changes in code: Every definition of those variables was removed to get a cleaner code
|
||||
|
||||
Note: This update does not change how the code works in any way
|
||||
@@ -152,16 +171,16 @@ Note: This update does not change how the code works in any way
|
||||
|
||||
## [v1.3.6] - 2022-Dec-19
|
||||
|
||||
1) Added code in show_ishare2_usage() function:
|
||||
1) Added code in show_ishare2_usage() function:
|
||||
|
||||
This code shows a message when a newer ishare2 upgrade is available when using `ishare2` command
|
||||
|
||||
|
||||

|
||||
|
||||
Message is displayed in yellow and is located at the bottom part of this command output
|
||||
|
||||
|
||||
Code looks cleaner and organized in that function now
|
||||
|
||||
|
||||
## [v1.3.5] - 2022-Dec-13
|
||||
|
||||
1) Added docker as an option of param1 (type) when using `ishare2`
|
||||
@@ -173,7 +192,7 @@ Note: This update does not change how the code works in any way
|
||||
## [v1.3.3] - 2022-Dec-13
|
||||
|
||||
1) Added a bin image to ishare2: "i86bi_LinuxL3-AdvEnterpriseK9-M2_157_3_May_2018.bin". This image was already available in ishare2 but the name was a little bit different (specifically it was: "i86bi_Linux-L3-AdvEnterpriseK9-M2_157_3_May_2018.bin"). So, this was made in order to be able to find and download this image in some labs that had this new name. So, it was decided to upload the same image but with a different name.
|
||||
2) Added support to download dockers from eveng docker hub (https://hub.docker.com/u/eveng) when present in lab files
|
||||
2) Added support to download dockers from eveng docker hub (<https://hub.docker.com/u/eveng>) when present in lab files
|
||||
3) Added `ishare2 installed docker` command. Also, available from `ishare2 installed all`
|
||||
4) Added green colors when using `ishare2 installed all` for better readabillity
|
||||
5) Added green colors when using `ishare2 labs` and `ishare2 mylabs` for better readabillity
|
||||
@@ -188,11 +207,11 @@ Note: This update does not change how the code works in any way
|
||||
1) Added a better description message when user tries to upgrade ishare2 and it already has the last version:
|
||||
|
||||
Before
|
||||
|
||||
|
||||
echo "You have the latest available version: $REMOTE_VALUE"
|
||||
|
||||
After
|
||||
|
||||
|
||||
echo "ishare2 $REMOTE_VALUE is currently the newest version available"
|
||||
|
||||
2) Added some validation related to check if the user is root when executing `ishare2`. If not root, an error message will be prompt and the script will finish
|
||||
@@ -215,4 +234,5 @@ Added some code to check docker service status in order to avoid problems when t
|
||||
* `ishare2 mylabs all`
|
||||
|
||||
## [v1.0] - 2022-Nov-22
|
||||
|
||||
Initial release
|
||||
|
||||
@@ -1,23 +1,35 @@
|
||||
```batch
|
||||
This script, designed to be used in Windows, allows you to crack MobaXterm from Home Edition to the Professional Edition using Python3
|
||||
This script, designed to be used in Windows, allows you to crack MobaXterm from Home/Personal to Professional Edition using Python3
|
||||
This code has been modified from its original version
|
||||
|
||||
Requirement: You must have Python3 installed in your computer (Tested and working with Python 3.10.6)
|
||||
```
|
||||
|
||||
# MobaXterm-Keygen-v2.py
|
||||
# crack-mobaxterm.py
|
||||
|
||||
### ✨ Quick installation and execution
|
||||
Use cmd or PowerShell to execute the following:
|
||||
```batch
|
||||
curl -s -o crack-mobaxterm.py https://raw.githubusercontent.com/pnetlabrepo/ishare2/main/mobaxterm/22.2/crack-mobaxterm.py && python crack-mobaxterm.py && del .\crack-mobaxterm.py
|
||||
```
|
||||
Note: After executing this python file, select `Yes` to confirm
|
||||
|
||||
### Installation
|
||||
Download this script into Windows applying this command in cmd or PowerShell:
|
||||
```batch
|
||||
curl -o MobaXterm-Keygen-v2.py https://raw.githubusercontent.com/pnetlabrepo/ishare2/main/mobaxterm/22.2/MobaXterm-Keygen-v2.py
|
||||
curl -s -o crack-mobaxterm.py https://raw.githubusercontent.com/pnetlabrepo/ishare2/main/mobaxterm/22.2/crack-mobaxterm.py
|
||||
```
|
||||
|
||||
### Useful information
|
||||
1. Syntax for this script is as follows:
|
||||
|
||||
```batch
|
||||
python MobaXterm-Keygen-v2.py <username> <version>
|
||||
python crack-mobaxterm.py [username] [version]
|
||||
```
|
||||
2. When installing MobaXterm, make sure installation path is one of the following because python code will be scanning them in order to know where Moba was installed:
|
||||
|
||||
Note: `username` and `version` are optional parameters
|
||||
|
||||
2. When installing MobaXterm, make sure installation path is one of the following because python code will be scanning them in order to know where MobaXterm.exe was installed:
|
||||
|
||||
```batch
|
||||
"C:\Program Files (x86)\Mobatek\MobaXterm\"
|
||||
@@ -25,18 +37,20 @@ python MobaXterm-Keygen-v2.py <username> <version>
|
||||
"E:\Program Files (x86)\Mobatek\MobaXterm\"
|
||||
```
|
||||
|
||||
Note: You can add a new installation path by modifing this list inside code
|
||||
|
||||
This allows the code to move the generated crack file to the MobaXterm´s installation path and open the software for you when crack process finishes.
|
||||
|
||||
If MobaXterm is installed in another path, crack file will be generated as well but it must be moved manually by you to complete the process.
|
||||
|
||||
### Execution
|
||||
Once MobaXterm is installed, locate in the same directory MobaXterm-Keygen-v2.py was downloaded and execute it with:
|
||||
Once MobaXterm is installed, locate in the same directory crack-mobaxterm.py was downloaded and execute it with:
|
||||
```batch
|
||||
python MobaXterm-Keygen-v2.py admin 22.2
|
||||
python crack-mobaxterm.py
|
||||
```
|
||||
|
||||
After executing this python file, select `Yes` to confirm
|
||||
|
||||
### Software used:
|
||||
|
||||
1. Python 3.10.6
|
||||
2. MobaXterm Home Edition v22.2 (Installer Edition): Green button at [MobaXterm Home Edition](https://mobaxterm.mobatek.net/download-home-edition.html)
|
||||
2. MobaXterm Home Edition v22.2 (Installer Edition)
|
||||
|
||||
@@ -1,235 +1,209 @@
|
||||
# /usr/bin/env python3
|
||||
|
||||
'''
|
||||
Author: Double Sine
|
||||
License: GPLv3
|
||||
Last modified: 10-Dec-2022
|
||||
'''
|
||||
|
||||
import ctypes
|
||||
import os
|
||||
import os.path
|
||||
import shutil
|
||||
import sys
|
||||
import zipfile
|
||||
|
||||
|
||||
def run_as_admin(argv=None):
|
||||
shell32 = ctypes.windll.shell32
|
||||
|
||||
if argv is None and shell32.IsUserAnAdmin():
|
||||
return True # When user is an admin
|
||||
|
||||
if argv is None:
|
||||
argv = sys.argv
|
||||
|
||||
if sys.version_info[0] >= 3: # Check Python 3 is being used
|
||||
unicode = str
|
||||
|
||||
if hasattr(sys, '_MEIPASS'):
|
||||
# Support pyinstaller wrapped program
|
||||
arguments = map(unicode, argv[1:])
|
||||
else:
|
||||
arguments = map(unicode, argv)
|
||||
|
||||
argument_line = u' '.join(arguments)
|
||||
executable = unicode(sys.executable)
|
||||
|
||||
response = shell32.ShellExecuteW(
|
||||
None,
|
||||
u"runas",
|
||||
executable,
|
||||
argument_line,
|
||||
None,
|
||||
1
|
||||
)
|
||||
|
||||
if response <= 32:
|
||||
return False # When user says No (to the window)
|
||||
return None # When user says Yes (to the window)
|
||||
|
||||
|
||||
variant_base64_table = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='
|
||||
|
||||
variant_base64_dict = {
|
||||
i: variant_base64_table[i] for i in range(len(variant_base64_table))
|
||||
}
|
||||
|
||||
variant_base64_reverse_dict = {
|
||||
variant_base64_table[i]: i for i in range(len(variant_base64_table))
|
||||
}
|
||||
|
||||
|
||||
def variant_base64_encode(bs: bytes):
|
||||
result = b''
|
||||
blocks_count, left_bytes = divmod(len(bs), 3)
|
||||
|
||||
for i in range(blocks_count):
|
||||
coding_int = int.from_bytes(bs[3 * i:3 * i + 3], 'little')
|
||||
block = variant_base64_dict[coding_int & 0x3f]
|
||||
block += variant_base64_dict[(coding_int >> 6) & 0x3f]
|
||||
block += variant_base64_dict[(coding_int >> 12) & 0x3f]
|
||||
block += variant_base64_dict[(coding_int >> 18) & 0x3f]
|
||||
result += block.encode()
|
||||
|
||||
if left_bytes == 0:
|
||||
return result
|
||||
elif left_bytes == 1:
|
||||
coding_int = int.from_bytes(bs[3 * blocks_count:], 'little')
|
||||
block = variant_base64_dict[coding_int & 0x3f]
|
||||
block += variant_base64_dict[(coding_int >> 6) & 0x3f]
|
||||
result += block.encode()
|
||||
return result
|
||||
else:
|
||||
coding_int = int.from_bytes(bs[3 * blocks_count:], 'little')
|
||||
block = variant_base64_dict[coding_int & 0x3f]
|
||||
block += variant_base64_dict[(coding_int >> 6) & 0x3f]
|
||||
block += variant_base64_dict[(coding_int >> 12) & 0x3f]
|
||||
result += block.encode()
|
||||
return result
|
||||
|
||||
|
||||
def variant_base64_decode(s: str):
|
||||
result = b''
|
||||
blocks_count, left_bytes = divmod(len(s), 4)
|
||||
|
||||
for i in range(blocks_count):
|
||||
block = variant_base64_reverse_dict[s[4 * i]]
|
||||
block += variant_base64_reverse_dict[s[4 * i + 1]] << 6
|
||||
block += variant_base64_reverse_dict[s[4 * i + 2]] << 12
|
||||
block += variant_base64_reverse_dict[s[4 * i + 3]] << 18
|
||||
result += block.to_bytes(3, 'little')
|
||||
|
||||
if left_bytes == 0:
|
||||
return result
|
||||
elif left_bytes == 2:
|
||||
block = variant_base64_reverse_dict[s[4 * blocks_count]]
|
||||
block += variant_base64_reverse_dict[s[4 * blocks_count + 1]] << 6
|
||||
result += block.to_bytes(1, 'little')
|
||||
return result
|
||||
elif left_bytes == 3:
|
||||
block = variant_base64_reverse_dict[s[4 * blocks_count]]
|
||||
block += variant_base64_reverse_dict[s[4 * blocks_count + 1]] << 6
|
||||
block += variant_base64_reverse_dict[s[4 * blocks_count + 2]] << 12
|
||||
result += block.to_bytes(2, 'little')
|
||||
return result
|
||||
else:
|
||||
raise ValueError('Invalid encoding.')
|
||||
|
||||
|
||||
def encrypt_bytes(key: int, bs: bytes):
|
||||
result = bytearray()
|
||||
for i in range(len(bs)):
|
||||
result.append(bs[i] ^ ((key >> 8) & 0xff))
|
||||
key = result[-1] & key | 0x482D
|
||||
return bytes(result)
|
||||
|
||||
|
||||
def decrypt_bytes(key: int, bs: bytes):
|
||||
result = bytearray()
|
||||
for i in range(len(bs)):
|
||||
result.append(bs[i] ^ ((key >> 8) & 0xff))
|
||||
key = bs[i] & key | 0x482D
|
||||
return bytes(result)
|
||||
|
||||
|
||||
class LicenseType:
|
||||
Professional = 1
|
||||
Educational = 3
|
||||
Personal = 4
|
||||
|
||||
|
||||
def generate_license(license_type: LicenseType, count: int, username: str, major_version: int, minor_version: int):
|
||||
assert (count >= 0)
|
||||
LicenseString = '%d#%s|%d%d#%d#%d3%d6%d#%d#%d#%d#' % (
|
||||
license_type,
|
||||
username, major_version, minor_version,
|
||||
count,
|
||||
major_version, minor_version, minor_version,
|
||||
0, # Unknown
|
||||
# No Games flag. 0 means "NoGames = false". But it does not work.
|
||||
0,
|
||||
0) # No Plugins flag. 0 means "NoPlugins = false". But it does not work.
|
||||
|
||||
encoded_license_string = variant_base64_encode(
|
||||
encrypt_bytes(0x787, LicenseString.encode())).decode()
|
||||
|
||||
with zipfile.ZipFile(os.path.join(os.getcwd(), 'Custom.mxtpro'), 'w') as f:
|
||||
f.writestr('Pro.key', data=encoded_license_string)
|
||||
|
||||
|
||||
def help():
|
||||
print("Usage:")
|
||||
print(" MobaXterm-Keygen.py <username> <version>\n")
|
||||
print(" <username>: The name MobaXterm will be licensed to")
|
||||
print(" <version> : MobaXterm version. Example: 22.2")
|
||||
print("\nExample: python MobaXterm-Keygen.py admin 22.2")
|
||||
|
||||
|
||||
def move_license_to(dst):
|
||||
src = os.path.join(os.getcwd(), 'Custom.mxtpro')
|
||||
|
||||
try:
|
||||
shutil.move(src, dst)
|
||||
except Exception as e:
|
||||
exit(1)
|
||||
|
||||
|
||||
def start_mobaxterm(executable_path):
|
||||
print("[*] Success!")
|
||||
print("[*] Opening MobaXterm...")
|
||||
os.startfile(executable_path)
|
||||
|
||||
|
||||
def main():
|
||||
number_of_args = len(sys.argv)
|
||||
|
||||
if number_of_args != 3:
|
||||
if number_of_args == 1:
|
||||
print(str(number_of_args) + " arg was provided but 3 are required")
|
||||
else:
|
||||
print(str(number_of_args) + " args were provided but 3 are required")
|
||||
help()
|
||||
exit(1)
|
||||
|
||||
response = run_as_admin()
|
||||
if response is False: # False means user selected either No or has closed the window
|
||||
exit(1)
|
||||
|
||||
major_version, minor_version = sys.argv[2].split('.')[0:2]
|
||||
major_version = int(major_version)
|
||||
minor_version = int(minor_version)
|
||||
|
||||
generate_license(
|
||||
license_type=LicenseType.Professional,
|
||||
count=1,
|
||||
username=sys.argv[1],
|
||||
major_version=major_version,
|
||||
minor_version=minor_version
|
||||
)
|
||||
|
||||
possible_moba_exe_locations = [
|
||||
"C:/Program Files (x86)/Mobatek/MobaXterm/MobaXterm.exe",
|
||||
"D:/Program Files (x86)/Mobatek/MobaXterm/MobaXterm.exe",
|
||||
"E:/Program Files (x86)/Mobatek/MobaXterm/MobaXterm.exe"
|
||||
]
|
||||
|
||||
executable_exists = False
|
||||
for path in possible_moba_exe_locations:
|
||||
if os.path.isfile(path):
|
||||
executable_path = path
|
||||
executable_exists = True
|
||||
break
|
||||
|
||||
if executable_exists:
|
||||
dst = executable_path[:-13] + "Custom.mxtpro"
|
||||
move_license_to(dst)
|
||||
start_mobaxterm(executable_path)
|
||||
else:
|
||||
print("[*] File Custom.mxtpro was generated at", os.getcwd())
|
||||
print(
|
||||
"[*] Move this file to MobaXterm\'s installation path and then execute MobaXterm.exe")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
# /usr/bin/env python3
|
||||
|
||||
'''
|
||||
Author: Double Sine
|
||||
License: GPLv3
|
||||
Last modified: 11-Feb-2023
|
||||
'''
|
||||
|
||||
import ctypes
|
||||
import os
|
||||
import os.path
|
||||
import shutil
|
||||
import sys
|
||||
import zipfile
|
||||
|
||||
|
||||
def run_as_admin(argv=None):
|
||||
shell32 = ctypes.windll.shell32
|
||||
|
||||
if argv is None and shell32.IsUserAnAdmin():
|
||||
return True # When user is an admin
|
||||
|
||||
if argv is None:
|
||||
argv = sys.argv
|
||||
|
||||
if sys.version_info[0] >= 3: # Check Python 3 is being used
|
||||
unicode = str
|
||||
|
||||
if hasattr(sys, '_MEIPASS'):
|
||||
# Support pyinstaller wrapped program
|
||||
arguments = map(unicode, argv[1:])
|
||||
else:
|
||||
arguments = map(unicode, argv)
|
||||
|
||||
argument_line = u' '.join(arguments)
|
||||
executable = unicode(sys.executable)
|
||||
|
||||
response = shell32.ShellExecuteW(
|
||||
None,
|
||||
u"runas",
|
||||
executable,
|
||||
argument_line,
|
||||
None,
|
||||
1
|
||||
)
|
||||
|
||||
if response <= 32:
|
||||
return False # When user says No (to the window)
|
||||
return None # When user says Yes (to the window)
|
||||
|
||||
|
||||
def variant_base64_encode(bs: bytes, variant_base64_dict):
|
||||
result = b''
|
||||
blocks_count, left_bytes = divmod(len(bs), 3)
|
||||
|
||||
for i in range(blocks_count):
|
||||
coding_int = int.from_bytes(bs[3 * i:3 * i + 3], 'little')
|
||||
block = variant_base64_dict[coding_int & 0x3f]
|
||||
block += variant_base64_dict[(coding_int >> 6) & 0x3f]
|
||||
block += variant_base64_dict[(coding_int >> 12) & 0x3f]
|
||||
block += variant_base64_dict[(coding_int >> 18) & 0x3f]
|
||||
result += block.encode()
|
||||
|
||||
if left_bytes == 0:
|
||||
return result
|
||||
elif left_bytes == 1:
|
||||
coding_int = int.from_bytes(bs[3 * blocks_count:], 'little')
|
||||
block = variant_base64_dict[coding_int & 0x3f]
|
||||
block += variant_base64_dict[(coding_int >> 6) & 0x3f]
|
||||
result += block.encode()
|
||||
return result
|
||||
else:
|
||||
coding_int = int.from_bytes(bs[3 * blocks_count:], 'little')
|
||||
block = variant_base64_dict[coding_int & 0x3f]
|
||||
block += variant_base64_dict[(coding_int >> 6) & 0x3f]
|
||||
block += variant_base64_dict[(coding_int >> 12) & 0x3f]
|
||||
result += block.encode()
|
||||
return result
|
||||
|
||||
|
||||
def encrypt_bytes(key: int, bs: bytes):
|
||||
result = bytearray()
|
||||
for i in range(len(bs)):
|
||||
result.append(bs[i] ^ ((key >> 8) & 0xff))
|
||||
key = result[-1] & key | 0x482D
|
||||
return bytes(result)
|
||||
|
||||
|
||||
def decrypt_bytes(key: int, bs: bytes):
|
||||
result = bytearray()
|
||||
for i in range(len(bs)):
|
||||
result.append(bs[i] ^ ((key >> 8) & 0xff))
|
||||
key = bs[i] & key | 0x482D
|
||||
return bytes(result)
|
||||
|
||||
|
||||
def generate_license(license_type, count: int, username: str, major_version: int, minor_version: int, variant_base64_dict):
|
||||
assert (count >= 0)
|
||||
LicenseString = '%d#%s|%d%d#%d#%d3%d6%d#%d#%d#%d#' % (
|
||||
license_type,
|
||||
username,
|
||||
major_version,
|
||||
minor_version,
|
||||
count,
|
||||
major_version,
|
||||
minor_version,
|
||||
minor_version,
|
||||
0, # Unknown
|
||||
# No Games flag. 0 means "NoGames = false". But it does not work.
|
||||
0,
|
||||
0) # No Plugins flag. 0 means "NoPlugins = false". But it does not work.
|
||||
|
||||
encoded_license_string = variant_base64_encode(
|
||||
encrypt_bytes(0x787, LicenseString.encode()), variant_base64_dict).decode()
|
||||
|
||||
with zipfile.ZipFile(os.path.join(os.getcwd(), 'Custom.mxtpro'), 'w') as f:
|
||||
f.writestr('Pro.key', data=encoded_license_string)
|
||||
|
||||
|
||||
def move_license_to(dst):
|
||||
src = os.path.join(os.getcwd(), 'Custom.mxtpro')
|
||||
|
||||
try:
|
||||
shutil.move(src, dst)
|
||||
except Exception:
|
||||
exit(1)
|
||||
|
||||
|
||||
def start_mobaxterm(executable_path):
|
||||
print("[*] Success!")
|
||||
print("[*] Opening MobaXterm...")
|
||||
os.startfile(executable_path)
|
||||
|
||||
|
||||
def config(sys):
|
||||
number_of_args = len(sys.argv)
|
||||
|
||||
if number_of_args == 3:
|
||||
username = sys.argv[1],
|
||||
username = ''.join(username)
|
||||
major_version, minor_version = sys.argv[2].split('.')[0:2]
|
||||
major_version = int(major_version)
|
||||
minor_version = int(minor_version)
|
||||
else:
|
||||
username = "admin"
|
||||
mobaxterm_version = "22.2"
|
||||
major_version, minor_version = mobaxterm_version.split('.')[0:2]
|
||||
major_version = int(major_version)
|
||||
minor_version = int(minor_version)
|
||||
|
||||
return username, major_version, minor_version
|
||||
|
||||
|
||||
def create_base64_dict():
|
||||
variant_base64_table = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='
|
||||
|
||||
variant_base64_dict = {
|
||||
i: variant_base64_table[i] for i in range(len(variant_base64_table))
|
||||
}
|
||||
|
||||
return variant_base64_dict
|
||||
|
||||
|
||||
def last_steps():
|
||||
possible_moba_exe_locations = [
|
||||
"C:/Program Files (x86)/Mobatek/MobaXterm/MobaXterm.exe",
|
||||
"D:/Program Files (x86)/Mobatek/MobaXterm/MobaXterm.exe",
|
||||
"E:/Program Files (x86)/Mobatek/MobaXterm/MobaXterm.exe"
|
||||
]
|
||||
|
||||
executable_exists = False
|
||||
for path in possible_moba_exe_locations:
|
||||
if os.path.isfile(path):
|
||||
executable_path = path
|
||||
executable_exists = True
|
||||
break # Exit for loop at the first match. Maybe, MobaXterm.exe is located in more than one path
|
||||
|
||||
if executable_exists:
|
||||
dst = executable_path[: -13] + "Custom.mxtpro"
|
||||
move_license_to(dst)
|
||||
start_mobaxterm(executable_path)
|
||||
else:
|
||||
print("[*] File Custom.mxtpro was generated at", os.getcwd())
|
||||
print("[*] Move Custom.mxtpro file to MobaXterm\'s installation path and then execute MobaXterm.exe")
|
||||
|
||||
|
||||
def main():
|
||||
username, major_version, minor_version = config(sys)
|
||||
|
||||
response = run_as_admin()
|
||||
if response is False: # False means user has choiced either "No" when prompted or has closed the window using the close button
|
||||
exit(1)
|
||||
|
||||
variant_base64_dict = create_base64_dict()
|
||||
|
||||
generate_license(
|
||||
license_type=1, # 1 for Professional, 3 for Educational and 4 for Personal
|
||||
count=1,
|
||||
username=username,
|
||||
major_version=major_version,
|
||||
minor_version=minor_version,
|
||||
variant_base64_dict=variant_base64_dict
|
||||
)
|
||||
|
||||
last_steps()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
@@ -1,23 +1,35 @@
|
||||
```batch
|
||||
This script, designed to be used in Windows, allows you to crack MobaXterm from Home Edition to the Professional Edition using Python3
|
||||
This script, designed to be used in Windows, allows you to crack MobaXterm from Home/Personal to Professional Edition using Python3
|
||||
This code has been modified from its original version
|
||||
|
||||
Requirement: You must have Python3 installed in your computer (Tested and working with Python 3.10.6)
|
||||
```
|
||||
|
||||
# MobaXterm-Keygen-v2.py
|
||||
# crack-mobaxterm.py
|
||||
|
||||
### ✨ Quick installation and execution
|
||||
Use cmd or PowerShell to execute the following:
|
||||
```batch
|
||||
curl -s -o crack-mobaxterm.py https://raw.githubusercontent.com/pnetlabrepo/ishare2/main/mobaxterm/22.3/crack-mobaxterm.py && python crack-mobaxterm.py && del .\crack-mobaxterm.py
|
||||
```
|
||||
Note: After executing this python file, select `Yes` to confirm
|
||||
|
||||
### Installation
|
||||
Download this script into Windows applying this command in cmd or PowerShell:
|
||||
```batch
|
||||
curl -o MobaXterm-Keygen-v2.py https://raw.githubusercontent.com/pnetlabrepo/ishare2/main/mobaxterm/22.3/MobaXterm-Keygen-v2.py
|
||||
curl -s -o crack-mobaxterm.py https://raw.githubusercontent.com/pnetlabrepo/ishare2/main/mobaxterm/22.3/crack-mobaxterm.py
|
||||
```
|
||||
|
||||
### Useful information
|
||||
1. Syntax for this script is as follows:
|
||||
|
||||
```batch
|
||||
python MobaXterm-Keygen-v2.py <username> <version>
|
||||
python crack-mobaxterm.py [username] [version]
|
||||
```
|
||||
2. When installing MobaXterm, make sure installation path is one of the following because python code will be scanning them in order to know where Moba was installed:
|
||||
|
||||
Note: `username` and `version` are optional parameters
|
||||
|
||||
2. When installing MobaXterm, make sure installation path is one of the following because python code will be scanning them in order to know where MobaXterm.exe was installed:
|
||||
|
||||
```batch
|
||||
"C:\Program Files (x86)\Mobatek\MobaXterm\"
|
||||
@@ -25,16 +37,18 @@ python MobaXterm-Keygen-v2.py <username> <version>
|
||||
"E:\Program Files (x86)\Mobatek\MobaXterm\"
|
||||
```
|
||||
|
||||
Note: You can add a new installation path by modifing this list inside code
|
||||
|
||||
This allows the code to move the generated crack file to the MobaXterm´s installation path and open the software for you when crack process finishes.
|
||||
|
||||
If MobaXterm is installed in another path, crack file will be generated as well but it must be moved manually by you to complete the process.
|
||||
|
||||
### Execution
|
||||
Once MobaXterm is installed, locate in the same directory MobaXterm-Keygen-v2.py was downloaded and execute it with:
|
||||
Once MobaXterm is installed, locate in the same directory crack-mobaxterm.py was downloaded and execute it with:
|
||||
```batch
|
||||
python MobaXterm-Keygen-v2.py admin 22.3
|
||||
python crack-mobaxterm.py
|
||||
```
|
||||
|
||||
After executing this python file, select `Yes` to confirm
|
||||
|
||||
### Software used:
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
'''
|
||||
Author: Double Sine
|
||||
License: GPLv3
|
||||
Last modified: 10-Dec-2022
|
||||
Last modified: 11-Feb-2023
|
||||
'''
|
||||
|
||||
import ctypes
|
||||
@@ -49,18 +49,7 @@ def run_as_admin(argv=None):
|
||||
return None # When user says Yes (to the window)
|
||||
|
||||
|
||||
variant_base64_table = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='
|
||||
|
||||
variant_base64_dict = {
|
||||
i: variant_base64_table[i] for i in range(len(variant_base64_table))
|
||||
}
|
||||
|
||||
variant_base64_reverse_dict = {
|
||||
variant_base64_table[i]: i for i in range(len(variant_base64_table))
|
||||
}
|
||||
|
||||
|
||||
def variant_base64_encode(bs: bytes):
|
||||
def variant_base64_encode(bs: bytes, variant_base64_dict):
|
||||
result = b''
|
||||
blocks_count, left_bytes = divmod(len(bs), 3)
|
||||
|
||||
@@ -89,34 +78,6 @@ def variant_base64_encode(bs: bytes):
|
||||
return result
|
||||
|
||||
|
||||
def variant_base64_decode(s: str):
|
||||
result = b''
|
||||
blocks_count, left_bytes = divmod(len(s), 4)
|
||||
|
||||
for i in range(blocks_count):
|
||||
block = variant_base64_reverse_dict[s[4 * i]]
|
||||
block += variant_base64_reverse_dict[s[4 * i + 1]] << 6
|
||||
block += variant_base64_reverse_dict[s[4 * i + 2]] << 12
|
||||
block += variant_base64_reverse_dict[s[4 * i + 3]] << 18
|
||||
result += block.to_bytes(3, 'little')
|
||||
|
||||
if left_bytes == 0:
|
||||
return result
|
||||
elif left_bytes == 2:
|
||||
block = variant_base64_reverse_dict[s[4 * blocks_count]]
|
||||
block += variant_base64_reverse_dict[s[4 * blocks_count + 1]] << 6
|
||||
result += block.to_bytes(1, 'little')
|
||||
return result
|
||||
elif left_bytes == 3:
|
||||
block = variant_base64_reverse_dict[s[4 * blocks_count]]
|
||||
block += variant_base64_reverse_dict[s[4 * blocks_count + 1]] << 6
|
||||
block += variant_base64_reverse_dict[s[4 * blocks_count + 2]] << 12
|
||||
result += block.to_bytes(2, 'little')
|
||||
return result
|
||||
else:
|
||||
raise ValueError('Invalid encoding.')
|
||||
|
||||
|
||||
def encrypt_bytes(key: int, bs: bytes):
|
||||
result = bytearray()
|
||||
for i in range(len(bs)):
|
||||
@@ -133,45 +94,35 @@ def decrypt_bytes(key: int, bs: bytes):
|
||||
return bytes(result)
|
||||
|
||||
|
||||
class LicenseType:
|
||||
Professional = 1
|
||||
Educational = 3
|
||||
Personal = 4
|
||||
|
||||
|
||||
def generate_license(license_type: LicenseType, count: int, username: str, major_version: int, minor_version: int):
|
||||
def generate_license(license_type, count: int, username: str, major_version: int, minor_version: int, variant_base64_dict):
|
||||
assert (count >= 0)
|
||||
LicenseString = '%d#%s|%d%d#%d#%d3%d6%d#%d#%d#%d#' % (
|
||||
license_type,
|
||||
username, major_version, minor_version,
|
||||
username,
|
||||
major_version,
|
||||
minor_version,
|
||||
count,
|
||||
major_version, minor_version, minor_version,
|
||||
0, # Unknown
|
||||
major_version,
|
||||
minor_version,
|
||||
minor_version,
|
||||
0, # Unknown
|
||||
# No Games flag. 0 means "NoGames = false". But it does not work.
|
||||
0,
|
||||
0) # No Plugins flag. 0 means "NoPlugins = false". But it does not work.
|
||||
0) # No Plugins flag. 0 means "NoPlugins = false". But it does not work.
|
||||
|
||||
encoded_license_string = variant_base64_encode(
|
||||
encrypt_bytes(0x787, LicenseString.encode())).decode()
|
||||
encrypt_bytes(0x787, LicenseString.encode()), variant_base64_dict).decode()
|
||||
|
||||
with zipfile.ZipFile(os.path.join(os.getcwd(), 'Custom.mxtpro'), 'w') as f:
|
||||
f.writestr('Pro.key', data=encoded_license_string)
|
||||
|
||||
|
||||
def help():
|
||||
print("Usage:")
|
||||
print(" MobaXterm-Keygen.py <username> <version>\n")
|
||||
print(" <username>: The name MobaXterm will be licensed to")
|
||||
print(" <version> : MobaXterm version. Example: 22.3")
|
||||
print("\nExample: python MobaXterm-Keygen.py admin 22.3")
|
||||
|
||||
|
||||
def move_license_to(dst):
|
||||
src = os.path.join(os.getcwd(), 'Custom.mxtpro')
|
||||
|
||||
try:
|
||||
shutil.move(src, dst)
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
exit(1)
|
||||
|
||||
|
||||
@@ -181,33 +132,36 @@ def start_mobaxterm(executable_path):
|
||||
os.startfile(executable_path)
|
||||
|
||||
|
||||
def main():
|
||||
def config(sys):
|
||||
number_of_args = len(sys.argv)
|
||||
|
||||
if number_of_args != 3:
|
||||
if number_of_args == 1:
|
||||
print(str(number_of_args) + " arg was provided but 3 are required")
|
||||
else:
|
||||
print(str(number_of_args) + " args were provided but 3 are required")
|
||||
help()
|
||||
exit(1)
|
||||
if number_of_args == 3:
|
||||
username = sys.argv[1],
|
||||
username = ''.join(username)
|
||||
major_version, minor_version = sys.argv[2].split('.')[0:2]
|
||||
major_version = int(major_version)
|
||||
minor_version = int(minor_version)
|
||||
else:
|
||||
username = "admin"
|
||||
mobaxterm_version = "22.3"
|
||||
major_version, minor_version = mobaxterm_version.split('.')[0:2]
|
||||
major_version = int(major_version)
|
||||
minor_version = int(minor_version)
|
||||
|
||||
response = run_as_admin()
|
||||
if response is False: # False means user selected either No or has closed the window
|
||||
exit(1)
|
||||
return username, major_version, minor_version
|
||||
|
||||
major_version, minor_version = sys.argv[2].split('.')[0:2]
|
||||
major_version = int(major_version)
|
||||
minor_version = int(minor_version)
|
||||
|
||||
generate_license(
|
||||
license_type=LicenseType.Professional,
|
||||
count=1,
|
||||
username=sys.argv[1],
|
||||
major_version=major_version,
|
||||
minor_version=minor_version
|
||||
)
|
||||
def create_base64_dict():
|
||||
variant_base64_table = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='
|
||||
|
||||
variant_base64_dict = {
|
||||
i: variant_base64_table[i] for i in range(len(variant_base64_table))
|
||||
}
|
||||
|
||||
return variant_base64_dict
|
||||
|
||||
|
||||
def last_steps():
|
||||
possible_moba_exe_locations = [
|
||||
"C:/Program Files (x86)/Mobatek/MobaXterm/MobaXterm.exe",
|
||||
"D:/Program Files (x86)/Mobatek/MobaXterm/MobaXterm.exe",
|
||||
@@ -219,16 +173,36 @@ def main():
|
||||
if os.path.isfile(path):
|
||||
executable_path = path
|
||||
executable_exists = True
|
||||
break
|
||||
break # Exit for loop at the first match. Maybe, MobaXterm.exe is located in more than one path
|
||||
|
||||
if executable_exists:
|
||||
dst = executable_path[:-13] + "Custom.mxtpro"
|
||||
dst = executable_path[: -13] + "Custom.mxtpro"
|
||||
move_license_to(dst)
|
||||
start_mobaxterm(executable_path)
|
||||
else:
|
||||
print("[*] File Custom.mxtpro was generated at", os.getcwd())
|
||||
print(
|
||||
"[*] Move this file to MobaXterm\'s installation path and then execute MobaXterm.exe")
|
||||
print("[*] Move Custom.mxtpro file to MobaXterm\'s installation path and then execute MobaXterm.exe")
|
||||
|
||||
|
||||
def main():
|
||||
username, major_version, minor_version = config(sys)
|
||||
|
||||
response = run_as_admin()
|
||||
if response is False: # False means user has choiced either "No" when prompted or has closed the window using the close button
|
||||
exit(1)
|
||||
|
||||
variant_base64_dict = create_base64_dict()
|
||||
|
||||
generate_license(
|
||||
license_type=1, # 1 for Professional, 3 for Educational and 4 for Personal
|
||||
count=1,
|
||||
username=username,
|
||||
major_version=major_version,
|
||||
minor_version=minor_version,
|
||||
variant_base64_dict=variant_base64_dict
|
||||
)
|
||||
|
||||
last_steps()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
56
mobaxterm/23.0/README.md
Normal file
56
mobaxterm/23.0/README.md
Normal file
@@ -0,0 +1,56 @@
|
||||
```batch
|
||||
This script, designed to be used in Windows, allows you to crack MobaXterm from Home/Personal to Professional Edition using Python3
|
||||
This code has been modified from its original version
|
||||
|
||||
Requirement: You must have Python3 installed in your computer (Tested and working with Python 3.10.6)
|
||||
```
|
||||
|
||||
# crack-mobaxterm.py
|
||||
|
||||
### ✨ Quick installation and execution
|
||||
Use cmd or PowerShell to execute the following:
|
||||
```batch
|
||||
curl -s -o crack-mobaxterm.py https://raw.githubusercontent.com/pnetlabrepo/ishare2/main/mobaxterm/23.0/crack-mobaxterm.py && python crack-mobaxterm.py && del .\crack-mobaxterm.py
|
||||
```
|
||||
Note: After executing this python file, select `Yes` to confirm
|
||||
|
||||
### Installation
|
||||
Download this script into Windows applying this command in cmd or PowerShell:
|
||||
```batch
|
||||
curl -s -o crack-mobaxterm.py https://raw.githubusercontent.com/pnetlabrepo/ishare2/main/mobaxterm/23.0/crack-mobaxterm.py
|
||||
```
|
||||
|
||||
### Useful information
|
||||
1. Syntax for this script is as follows:
|
||||
|
||||
```batch
|
||||
python crack-mobaxterm.py [username] [version]
|
||||
```
|
||||
|
||||
Note: `username` and `version` are optional parameters
|
||||
|
||||
2. When installing MobaXterm, make sure installation path is one of the following because python code will be scanning them in order to know where MobaXterm.exe was installed:
|
||||
|
||||
```batch
|
||||
"C:\Program Files (x86)\Mobatek\MobaXterm\"
|
||||
"D:\Program Files (x86)\Mobatek\MobaXterm\"
|
||||
"E:\Program Files (x86)\Mobatek\MobaXterm\"
|
||||
```
|
||||
|
||||
Note: You can add a new installation path by modifing this list inside code
|
||||
|
||||
This allows the code to move the generated crack file to the MobaXterm´s installation path and open the software for you when crack process finishes.
|
||||
|
||||
If MobaXterm is installed in another path, crack file will be generated as well but it must be moved manually by you to complete the process.
|
||||
|
||||
### Execution
|
||||
Once MobaXterm is installed, locate in the same directory crack-mobaxterm.py was downloaded and execute it with:
|
||||
```batch
|
||||
python crack-mobaxterm.py
|
||||
```
|
||||
After executing this python file, select `Yes` to confirm
|
||||
|
||||
### Software used:
|
||||
|
||||
1. Python 3.10.6
|
||||
2. MobaXterm Home Edition v23.0 (Installer Edition): Green button at [MobaXterm Home Edition](https://mobaxterm.mobatek.net/download-home-edition.html)
|
||||
209
mobaxterm/23.0/crack-mobaxterm.py
Normal file
209
mobaxterm/23.0/crack-mobaxterm.py
Normal file
@@ -0,0 +1,209 @@
|
||||
# /usr/bin/env python3
|
||||
|
||||
'''
|
||||
Author: Double Sine
|
||||
License: GPLv3
|
||||
Last modified: 11-Feb-2023
|
||||
'''
|
||||
|
||||
import ctypes
|
||||
import os
|
||||
import os.path
|
||||
import shutil
|
||||
import sys
|
||||
import zipfile
|
||||
|
||||
|
||||
def run_as_admin(argv=None):
|
||||
shell32 = ctypes.windll.shell32
|
||||
|
||||
if argv is None and shell32.IsUserAnAdmin():
|
||||
return True # When user is an admin
|
||||
|
||||
if argv is None:
|
||||
argv = sys.argv
|
||||
|
||||
if sys.version_info[0] >= 3: # Check Python 3 is being used
|
||||
unicode = str
|
||||
|
||||
if hasattr(sys, '_MEIPASS'):
|
||||
# Support pyinstaller wrapped program
|
||||
arguments = map(unicode, argv[1:])
|
||||
else:
|
||||
arguments = map(unicode, argv)
|
||||
|
||||
argument_line = u' '.join(arguments)
|
||||
executable = unicode(sys.executable)
|
||||
|
||||
response = shell32.ShellExecuteW(
|
||||
None,
|
||||
u"runas",
|
||||
executable,
|
||||
argument_line,
|
||||
None,
|
||||
1
|
||||
)
|
||||
|
||||
if response <= 32:
|
||||
return False # When user says No (to the window)
|
||||
return None # When user says Yes (to the window)
|
||||
|
||||
|
||||
def variant_base64_encode(bs: bytes, variant_base64_dict):
|
||||
result = b''
|
||||
blocks_count, left_bytes = divmod(len(bs), 3)
|
||||
|
||||
for i in range(blocks_count):
|
||||
coding_int = int.from_bytes(bs[3 * i:3 * i + 3], 'little')
|
||||
block = variant_base64_dict[coding_int & 0x3f]
|
||||
block += variant_base64_dict[(coding_int >> 6) & 0x3f]
|
||||
block += variant_base64_dict[(coding_int >> 12) & 0x3f]
|
||||
block += variant_base64_dict[(coding_int >> 18) & 0x3f]
|
||||
result += block.encode()
|
||||
|
||||
if left_bytes == 0:
|
||||
return result
|
||||
elif left_bytes == 1:
|
||||
coding_int = int.from_bytes(bs[3 * blocks_count:], 'little')
|
||||
block = variant_base64_dict[coding_int & 0x3f]
|
||||
block += variant_base64_dict[(coding_int >> 6) & 0x3f]
|
||||
result += block.encode()
|
||||
return result
|
||||
else:
|
||||
coding_int = int.from_bytes(bs[3 * blocks_count:], 'little')
|
||||
block = variant_base64_dict[coding_int & 0x3f]
|
||||
block += variant_base64_dict[(coding_int >> 6) & 0x3f]
|
||||
block += variant_base64_dict[(coding_int >> 12) & 0x3f]
|
||||
result += block.encode()
|
||||
return result
|
||||
|
||||
|
||||
def encrypt_bytes(key: int, bs: bytes):
|
||||
result = bytearray()
|
||||
for i in range(len(bs)):
|
||||
result.append(bs[i] ^ ((key >> 8) & 0xff))
|
||||
key = result[-1] & key | 0x482D
|
||||
return bytes(result)
|
||||
|
||||
|
||||
def decrypt_bytes(key: int, bs: bytes):
|
||||
result = bytearray()
|
||||
for i in range(len(bs)):
|
||||
result.append(bs[i] ^ ((key >> 8) & 0xff))
|
||||
key = bs[i] & key | 0x482D
|
||||
return bytes(result)
|
||||
|
||||
|
||||
def generate_license(license_type, count: int, username: str, major_version: int, minor_version: int, variant_base64_dict):
|
||||
assert (count >= 0)
|
||||
LicenseString = '%d#%s|%d%d#%d#%d3%d6%d#%d#%d#%d#' % (
|
||||
license_type,
|
||||
username,
|
||||
major_version,
|
||||
minor_version,
|
||||
count,
|
||||
major_version,
|
||||
minor_version,
|
||||
minor_version,
|
||||
0, # Unknown
|
||||
# No Games flag. 0 means "NoGames = false". But it does not work.
|
||||
0,
|
||||
0) # No Plugins flag. 0 means "NoPlugins = false". But it does not work.
|
||||
|
||||
encoded_license_string = variant_base64_encode(
|
||||
encrypt_bytes(0x787, LicenseString.encode()), variant_base64_dict).decode()
|
||||
|
||||
with zipfile.ZipFile(os.path.join(os.getcwd(), 'Custom.mxtpro'), 'w') as f:
|
||||
f.writestr('Pro.key', data=encoded_license_string)
|
||||
|
||||
|
||||
def move_license_to(dst):
|
||||
src = os.path.join(os.getcwd(), 'Custom.mxtpro')
|
||||
|
||||
try:
|
||||
shutil.move(src, dst)
|
||||
except Exception:
|
||||
exit(1)
|
||||
|
||||
|
||||
def start_mobaxterm(executable_path):
|
||||
print("[*] Success!")
|
||||
print("[*] Opening MobaXterm...")
|
||||
os.startfile(executable_path)
|
||||
|
||||
|
||||
def config(sys):
|
||||
number_of_args = len(sys.argv)
|
||||
|
||||
if number_of_args == 3:
|
||||
username = sys.argv[1],
|
||||
username = ''.join(username)
|
||||
major_version, minor_version = sys.argv[2].split('.')[0:2]
|
||||
major_version = int(major_version)
|
||||
minor_version = int(minor_version)
|
||||
else:
|
||||
username = "admin"
|
||||
mobaxterm_version = "23.0"
|
||||
major_version, minor_version = mobaxterm_version.split('.')[0:2]
|
||||
major_version = int(major_version)
|
||||
minor_version = int(minor_version)
|
||||
|
||||
return username, major_version, minor_version
|
||||
|
||||
|
||||
def create_base64_dict():
|
||||
variant_base64_table = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='
|
||||
|
||||
variant_base64_dict = {
|
||||
i: variant_base64_table[i] for i in range(len(variant_base64_table))
|
||||
}
|
||||
|
||||
return variant_base64_dict
|
||||
|
||||
|
||||
def last_steps():
|
||||
possible_moba_exe_locations = [
|
||||
"C:/Program Files (x86)/Mobatek/MobaXterm/MobaXterm.exe",
|
||||
"D:/Program Files (x86)/Mobatek/MobaXterm/MobaXterm.exe",
|
||||
"E:/Program Files (x86)/Mobatek/MobaXterm/MobaXterm.exe"
|
||||
]
|
||||
|
||||
executable_exists = False
|
||||
for path in possible_moba_exe_locations:
|
||||
if os.path.isfile(path):
|
||||
executable_path = path
|
||||
executable_exists = True
|
||||
break # Exit for loop at the first match. Maybe, MobaXterm.exe is located in more than one path
|
||||
|
||||
if executable_exists:
|
||||
dst = executable_path[: -13] + "Custom.mxtpro"
|
||||
move_license_to(dst)
|
||||
start_mobaxterm(executable_path)
|
||||
else:
|
||||
print("[*] File Custom.mxtpro was generated at", os.getcwd())
|
||||
print("[*] Move Custom.mxtpro file to MobaXterm\'s installation path and then execute MobaXterm.exe")
|
||||
|
||||
|
||||
def main():
|
||||
username, major_version, minor_version = config(sys)
|
||||
|
||||
response = run_as_admin()
|
||||
if response is False: # False means user has choiced either "No" when prompted or has closed the window using the close button
|
||||
exit(1)
|
||||
|
||||
variant_base64_dict = create_base64_dict()
|
||||
|
||||
generate_license(
|
||||
license_type=1, # 1 for Professional, 3 for Educational and 4 for Personal
|
||||
count=1,
|
||||
username=username,
|
||||
major_version=major_version,
|
||||
minor_version=minor_version,
|
||||
variant_base64_dict=variant_base64_dict
|
||||
)
|
||||
|
||||
last_steps()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
Reference in New Issue
Block a user