mirror of
https://github.com/tonikelope/megabasterd.git
synced 2025-05-13 04:47:12 +02:00
2.27
This commit is contained in:
parent
7faefbbb26
commit
aa05fcb510
@ -565,16 +565,16 @@ public final class CryptTools {
|
||||
|
||||
out.write(buffer, 0, reads);
|
||||
}
|
||||
enc_dlc_key = findFirstRegex("< *rc *>(.+)< */ *rc *>", new String(out.toByteArray()), 1);
|
||||
enc_dlc_key = findFirstRegex("< *rc *>(.+?)< */ *rc *>", new String(out.toByteArray()), 1);
|
||||
}
|
||||
|
||||
String dec_dlc_key = new String(CryptTools.aes_ecb_decrypt(BASE642Bin(enc_dlc_key), hex2bin(dlc_master_key))).trim();
|
||||
|
||||
String dec_dlc_data = new String(CryptTools.aes_cbc_decrypt(BASE642Bin(enc_dlc_data), BASE642Bin(dec_dlc_key), BASE642Bin(dec_dlc_key))).trim();
|
||||
|
||||
String dec_dlc_data_file = findFirstRegex("< *file *>(.+)< */ *file *>", new String(BASE642Bin(dec_dlc_data)), 1);
|
||||
String dec_dlc_data_file = findFirstRegex("< *file *>(.+?)< */ *file *>", new String(BASE642Bin(dec_dlc_data), "UTF-8"), 1);
|
||||
|
||||
ArrayList<String> urls = findAllRegex("< *url *>(.+)< */ *url *>", dec_dlc_data_file, 1);
|
||||
ArrayList<String> urls = findAllRegex("< *url *>(.+?)< */ *url *>", dec_dlc_data_file, 1);
|
||||
|
||||
for (String s : urls) {
|
||||
|
||||
|
@ -45,7 +45,7 @@ import org.apache.http.auth.UsernamePasswordCredentials;
|
||||
*/
|
||||
public final class MainPanel {
|
||||
|
||||
public static final String VERSION = "2.26";
|
||||
public static final String VERSION = "2.27";
|
||||
public static final int THROTTLE_SLICE_SIZE = 16 * 1024;
|
||||
public static final int DEFAULT_BYTE_BUFFER_SIZE = 16 * 1024;
|
||||
public static final int STREAMER_PORT = 1337;
|
||||
@ -211,6 +211,7 @@ public final class MainPanel {
|
||||
} else {
|
||||
_mega_proxy_server = null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public MegaProxyServer getMega_proxy_server() {
|
||||
|
@ -152,18 +152,22 @@ public final class MegaAPI {
|
||||
|
||||
public void login(String email, String password) throws Exception, MegaAPIException {
|
||||
|
||||
_email = email;
|
||||
String[] email_split = email.split(" *# *");
|
||||
|
||||
_email = email_split[0];
|
||||
|
||||
_password_aes = MEGAPrepareMasterKey(bin2i32a(password.getBytes()));
|
||||
|
||||
_user_hash = MEGAUserHash(email.toLowerCase().getBytes(), _password_aes);
|
||||
_user_hash = MEGAUserHash(_email.toLowerCase().getBytes(), _password_aes);
|
||||
|
||||
_realLogin();
|
||||
}
|
||||
|
||||
public void fastLogin(String email, int[] password_aes, String user_hash) throws Exception, MegaAPIException {
|
||||
|
||||
_email = email;
|
||||
String[] email_split = email.split(" *# *");
|
||||
|
||||
_email = email_split[0];
|
||||
|
||||
_password_aes = password_aes;
|
||||
|
||||
|
@ -62,6 +62,7 @@ import org.apache.http.HttpRequestInterceptor;
|
||||
import org.apache.http.HttpStatus;
|
||||
import org.apache.http.auth.AuthScope;
|
||||
import org.apache.http.client.CredentialsProvider;
|
||||
import org.apache.http.client.config.RequestConfig;
|
||||
import org.apache.http.client.methods.CloseableHttpResponse;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.client.protocol.RequestAddCookies;
|
||||
@ -239,7 +240,7 @@ public final class MiscTools {
|
||||
}
|
||||
|
||||
public static String findFirstRegex(String regex, String data, int group) {
|
||||
Pattern pattern = Pattern.compile(regex);
|
||||
Pattern pattern = Pattern.compile(regex, Pattern.DOTALL);
|
||||
|
||||
Matcher matcher = pattern.matcher(data);
|
||||
|
||||
@ -247,7 +248,7 @@ public final class MiscTools {
|
||||
}
|
||||
|
||||
public static ArrayList<String> findAllRegex(String regex, String data, int group) {
|
||||
Pattern pattern = Pattern.compile(regex);
|
||||
Pattern pattern = Pattern.compile(regex, Pattern.DOTALL);
|
||||
|
||||
Matcher matcher = pattern.matcher(data);
|
||||
|
||||
@ -938,6 +939,42 @@ public final class MiscTools {
|
||||
return url_ok;
|
||||
}
|
||||
|
||||
public static String getMyPublicIP() {
|
||||
|
||||
String public_ip = null;
|
||||
|
||||
try (CloseableHttpClient httpclient = getApacheKissHttpClientNOProxy()) {
|
||||
|
||||
HttpGet httpget = new HttpGet(new URI("http://whatismyip.akamai.com/"));
|
||||
|
||||
try (CloseableHttpResponse httpresponse = httpclient.execute(httpget)) {
|
||||
|
||||
InputStream is = httpresponse.getEntity().getContent();
|
||||
|
||||
try (ByteArrayOutputStream byte_res = new ByteArrayOutputStream()) {
|
||||
|
||||
byte[] buffer = new byte[MainPanel.DEFAULT_BYTE_BUFFER_SIZE];
|
||||
|
||||
int reads;
|
||||
|
||||
while ((reads = is.read(buffer)) != -1) {
|
||||
|
||||
byte_res.write(buffer, 0, reads);
|
||||
}
|
||||
|
||||
public_ip = new String(byte_res.toByteArray());
|
||||
}
|
||||
}
|
||||
|
||||
} catch (MalformedURLException ex) {
|
||||
Logger.getLogger(MiscTools.class.getName()).log(Level.SEVERE, null, ex);
|
||||
} catch (IOException | URISyntaxException ex) {
|
||||
Logger.getLogger(MiscTools.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
|
||||
return public_ip;
|
||||
}
|
||||
|
||||
public static String checkNewVersion(String folder_node, String folder_key) {
|
||||
|
||||
String new_version = null;
|
||||
@ -1039,6 +1076,42 @@ public final class MiscTools {
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
public static CloseableHttpClient getApacheKissHttpClientSmartProxy() {
|
||||
|
||||
HttpClientBuilder builder = _getApacheKissHttpClientBuilder();
|
||||
|
||||
if (MainPanel.isUse_proxy() && MainPanel.getProxy_host() != null) {
|
||||
|
||||
HttpHost proxy = new HttpHost(MainPanel.getProxy_host(), MainPanel.getProxy_port());
|
||||
|
||||
builder = builder.setProxy(proxy);
|
||||
|
||||
if (MainPanel.getProxy_credentials() != null) {
|
||||
|
||||
CredentialsProvider credsProvider = new BasicCredentialsProvider();
|
||||
|
||||
AuthScope authScope = new AuthScope(MainPanel.getProxy_host(), MainPanel.getProxy_port());
|
||||
|
||||
credsProvider.setCredentials(authScope, MainPanel.getProxy_credentials());
|
||||
|
||||
builder = builder.setDefaultCredentialsProvider(credsProvider);
|
||||
}
|
||||
}
|
||||
|
||||
RequestConfig requestConfig = RequestConfig.custom()
|
||||
.setSocketTimeout(SmartMegaProxyManager.TIMEOUT * 1000)
|
||||
.setConnectTimeout(SmartMegaProxyManager.TIMEOUT * 1000)
|
||||
.setConnectionRequestTimeout(SmartMegaProxyManager.TIMEOUT * 1000)
|
||||
.build();
|
||||
|
||||
return builder.setDefaultRequestConfig(requestConfig).build();
|
||||
}
|
||||
|
||||
public static CloseableHttpClient getApacheKissHttpClientNOProxy() {
|
||||
|
||||
return _getApacheKissHttpClientBuilder().build();
|
||||
}
|
||||
|
||||
public static byte[] recReverseArray(byte[] arr, int start, int end) {
|
||||
|
||||
byte temp;
|
||||
@ -1068,7 +1141,7 @@ public final class MiscTools {
|
||||
|
||||
cmd.append("-cp ").append(ManagementFactory.getRuntimeMXBean().getClassPath()).append(" ");
|
||||
|
||||
cmd.append(MiscTools.class.getName()).append(" ");
|
||||
cmd.append(MainPanel.class.getName()).append(" ");
|
||||
|
||||
cmd.append(String.valueOf(delay));
|
||||
|
||||
|
31
src/megabasterd/SmartMegaProxyManager.java
Normal file
31
src/megabasterd/SmartMegaProxyManager.java
Normal file
@ -0,0 +1,31 @@
|
||||
package megabasterd;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author tonikelope
|
||||
*/
|
||||
public class SmartMegaProxyManager implements Runnable {
|
||||
|
||||
public static final int TIMEOUT = 15;
|
||||
private final String _proxy_list_url;
|
||||
private final ConcurrentHashMap<String, HashMap> _proxy_list;
|
||||
|
||||
public SmartMegaProxyManager(String proxy_list_url) {
|
||||
_proxy_list_url = proxy_list_url;
|
||||
_proxy_list = new ConcurrentHashMap<>();
|
||||
}
|
||||
|
||||
public HashMap getRandomProxy() {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user