-
Apache (mod_rewrite ON) (Or another web server that supports URL rewrite)
-
PHP >= 5.5 (cURL + memcache + mbstring)
-
MySQL (optional for blacklist).
Step 1: download tarball (or clone repo) and upload to your server.
Step 2: install composer dependencies -> $ php composer.phar install
Step 3: rename ALL /config .sample extension and edit miscellaneous.php and any other file you need.
Step 4: prepare Apache virtual host:
<VirtualHost *:80>
Servername megacrypter.mydomain
DocumentRoot /var/www/megacrypter/public
RewriteEngine On
<directory /var/www/megacrypter/public>
AllowOverride None
Include /var/www/megacrypter/public/.htaccess
</directory>
</VirtualHost>
Step 5: ask developers of your favourite download manager to recognize your new megacrypter links (or give it a try to Megabasterd that supports any MC clon)
You're alone from here. Good luck!
API URL -> http(s)://[BASE_URL]/api
(Content-Type: application/json)
{"m": "crypt",
"links": ["MEGA_LINK_1", "MEGA_LINK_2" ... "MEGA_LINK_N"],
*"expire": 0-6,
*"no_expire_token": true OR false,
*"tiny_url": true OR false,
*"app_finfo": true OR false,
*"hide_name": true OR false,
*"pass": "PASS",
*"referer": "DOMAIN_NAME",
*"extra_info": "EXTRA_INFO",
*"email": "EMAIL",
*"folder_node_list": ["NODE_ID_1", "NODE_ID_2" ... "NODE_ID_N"]}
- Expiration values: 0 -> never (default), 1 -> 10 minutes, 2 -> 1 hour...
- True by default.
- Tiny url option is false by default.
- Append file info option is false by default.
- Hide name option is false by default.
- Passwords are case-sensitive.
- Referer is not required to include 'http://'. It's limited to 256 chars
- Extra-info is limited to 256 chars.
- Email is limited to 256 chars.
- Only encrypt and return the indicated folder child nodes. Note: link list is limited to 500
{"links": ["MC_LINK_1", "MC_LINK_2" ... "MC_LINK_N"]}
{"m": "info",
"link": "MC_LINK",
*"reverse": "port:b64_proxy_auth[:host]"}
- Reverse query: Megacrypter will connect to MEGA API using HTTPS proxy running on the client. Client must send port and 'user:password' (base64 encoded) for proxy auth (host is optional).
{"name": "FILE_NAME" OR "CRYPTED_FILE_NAME",
"path": false OR "PATH" OR "CRYPTED_FILE_PATH",
"size": FILE_SIZE,
"key": "FILE_KEY" OR "CRYPTED_FILE_KEY",
"extra": false OR "EXTRA_INFO" OR "CRYPTED_EXTRA_INFO",
"expire": false OR "EXPIRE_TIMESTAMP#NOEXPIRE_TOKEN",
"pass": false OR "ITER_LOG2#KCV#SALT#IV"}
File name, file key, and extra-info will be returned crypted using AES CBC (PKCS7) with 256 bits key derivated from pass (PBKDF2 SHA256).
Follow this algorithm to decrypt crypted fields:
REPEAT
password := read_password()
info_key := hmac := hmac_sha256(password, base64_dec(SALT) + hex2bin('00000001'))
FOR i=2 : 1 : pow(2, ITER_LOG2)
hmac := hmac_sha256(password, hmac)
info_key := info_key XOR hmac
END
UNTIL aes_cbc_dec(base64_dec(KCV), info_key, base64_dec(IV)) = info_key
crypted_field := aes_cbc_dec(base64_dec(CRYPTED_FIELD), info_key, base64_dec(IV))
{"m": "dl",
"link": "MC_LINK",
*"ssl": true OR false,
*"noexpire": "NOEXPIRE_TOKEN",
*"sid" : "MEGA_SID",
*"reverse": "port:b64_proxy_auth[:host]"}
- Default is false (better performance in slow machines)
- If link has expiration time you can use NOEXPIRE_TOKEN (cached from a previous "info-request") to bypass it and get the download url.
- MEGA SESSION ID (for download MegaCrypter link using your MEGA PRO ACCOUNT)
- Reverse query: Megacrypter will connect to MEGA API using HTTPS proxy running on the client. Client must send port and 'user:password' (base64 encoded) for proxy auth (host is optional).
{"url": "MEGA_TEMP_URL" OR "CRYPTED_MEGA_TEMP_URL",
"pass": false OR "IV"}
Note: use the same algorithm described above to decrypt temp url (if password protected)
{"error": ERROR_CODE}
MC_EMETHOD(1)
MC_EREQ(2)
MC_ETOOMUCHLINKS(3)
MC_ENOLINKS(4)
MC_INTERNAL_ERROR(21)
MC_LINK_ERROR(22)
MC_BLACKLISTED_LINK(23)
MC_EXPIRED_LINK(24)
MEGA_EINTERNAL(-1)
MEGA_EARGS(-2)
MEGA_EAGAIN(-3)
MEGA_ERATELIMIT(-4)
MEGA_EFAILED(-5)
MEGA_ETOOMANY(-6)
MEGA_ERANGE(-7)
MEGA_EEXPIRED(-8)
MEGA_ENOENT(-9)
MEGA_ECIRCULAR(-10)
MEGA_EACCESS(-11)
MEGA_EEXIST(-12)
MEGA_EINCOMPLETE(-13)
MEGA_EKEY(-14)
MEGA_ESID(-15)
MEGA_EBLOCKED(-16)
MEGA_EOVERQUOTA(-17)
MEGA_ETEMPUNAVAIL(-18)
MEGA_ETOOMANYCONNECTIONS(-19)
MEGA_EWRITE(-20)
MEGA_EREAD(-21)
MEGA_EAPPKEY(-22)
MEGA_EDLURL(-101)