Skip to content

Commit

Permalink
7.44
Browse files Browse the repository at this point in the history
Fix -> #355

Cause: javax.net.ssl.SSLException: Server selected improper ciphersuite
  • Loading branch information
tonikelope committed Oct 11, 2021
1 parent 2f83fb9 commit 646eb6b
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 68 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.tonikelope</groupId>
<artifactId>MegaBasterd</artifactId>
<version>7.43</version>
<version>7.44</version>
<packaging>jar</packaging>
<dependencies>
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/tonikelope/megabasterd/MainPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
*/
public final class MainPanel {

public static final String VERSION = "7.43";
public static final String VERSION = "7.44";
public static final boolean FORCE_SMART_PROXY = false; //TRUE FOR DEBUGING SMART PROXY
public static final int THROTTLE_SLICE_SIZE = 16 * 1024;
public static final int DEFAULT_BYTE_BUFFER_SIZE = 16 * 1024;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ private void _new_upload_dialog(FileGrabberDialog dialog) {

LOG.log(SEVERE, null, ex);
}

};

getMain_panel().getUpload_manager().getTransference_preprocess_queue().add(run);
Expand Down
72 changes: 43 additions & 29 deletions src/main/java/com/tonikelope/megabasterd/MegaAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLException;

/**
*
Expand Down Expand Up @@ -495,6 +496,12 @@ private String _rawRequest(String request, URL url_api) throws MegaAPIException

}

} catch (SSLException ssl_ex) {

empty_response = true;

Logger.getLogger(MegaAPI.class.getName()).log(Level.SEVERE, ssl_ex.getMessage());

} catch (IOException ex) {

Logger.getLogger(MegaAPI.class.getName()).log(Level.SEVERE, ex.getMessage());
Expand Down Expand Up @@ -925,70 +932,77 @@ public String cryptoHandleauth(String h) {

public HashMap<String, Object> getFolderNodes(String folder_id, String folder_key) throws Exception {

HashMap<String, Object> folder_nodes;
HashMap<String, Object> folder_nodes = null;

String request = "[{\"a\":\"f\", \"c\":\"1\", \"r\":\"1\"}]";

URL url_api = new URL(API_URL + "/cs?id=" + String.valueOf(_seqno) + (API_KEY != null ? "&ak=" + API_KEY : "") + "&n=" + folder_id);

String res = _rawRequest(request, url_api);

ObjectMapper objectMapper = new ObjectMapper();
if (res != null) {

HashMap[] res_map = objectMapper.readValue(res, HashMap[].class);
ObjectMapper objectMapper = new ObjectMapper();

folder_nodes = new HashMap<>();
HashMap[] res_map = objectMapper.readValue(res, HashMap[].class);

for (Object o : (Iterable<? extends Object>) res_map[0].get("f")) {
folder_nodes = new HashMap<>();

HashMap<String, Object> node = (HashMap<String, Object>) o;
for (Object o : (Iterable<? extends Object>) res_map[0].get("f")) {

String[] node_k = ((String) node.get("k")).split(":");
HashMap<String, Object> node = (HashMap<String, Object>) o;

if (node_k.length == 2 && node_k[0] != "" && node_k[1] != "") {
String[] node_k = ((String) node.get("k")).split(":");

try {
if (node_k.length == 2 && node_k[0] != "" && node_k[1] != "") {

String dec_node_k = Bin2UrlBASE64(decryptKey(UrlBASE642Bin(node_k[1]), _urlBase64KeyDecode(folder_key)));
try {

HashMap at = _decAttr((String) node.get("a"), _urlBase64KeyDecode(dec_node_k));
String dec_node_k = Bin2UrlBASE64(decryptKey(UrlBASE642Bin(node_k[1]), _urlBase64KeyDecode(folder_key)));

HashMap<String, Object> the_node = new HashMap<>();
HashMap at = _decAttr((String) node.get("a"), _urlBase64KeyDecode(dec_node_k));

the_node.put("type", node.get("t"));
HashMap<String, Object> the_node = new HashMap<>();

the_node.put("parent", node.get("p"));
the_node.put("type", node.get("t"));

the_node.put("key", dec_node_k);
the_node.put("parent", node.get("p"));

if (node.get("s") != null) {
the_node.put("key", dec_node_k);

if (node.get("s") instanceof Integer) {
if (node.get("s") != null) {

long size = ((Number) node.get("s")).longValue();
the_node.put("size", size);
if (node.get("s") instanceof Integer) {

} else if (node.get("s") instanceof Long) {
long size = ((Number) node.get("s")).longValue();
the_node.put("size", size);

long size = (Long) node.get("s");
the_node.put("size", size);
} else if (node.get("s") instanceof Long) {

long size = (Long) node.get("s");
the_node.put("size", size);
}
}
}

the_node.put("name", at.get("n"));
the_node.put("name", at.get("n"));

the_node.put("h", node.get("h"));
the_node.put("h", node.get("h"));

folder_nodes.put((String) node.get("h"), the_node);
folder_nodes.put((String) node.get("h"), the_node);

} catch (Exception e) {
LOG.log(Level.WARNING, "WARNING: node key is not valid " + (String) node.get("k"));
}

} catch (Exception e) {
} else {
LOG.log(Level.WARNING, "WARNING: node key is not valid " + (String) node.get("k"));
}

} else {
LOG.log(Level.WARNING, "WARNING: node key is not valid " + (String) node.get("k"));
}

} else {

throw new Exception();
}

return folder_nodes;
Expand Down
50 changes: 13 additions & 37 deletions src/main/java/com/tonikelope/megabasterd/MiscTools.java
Original file line number Diff line number Diff line change
Expand Up @@ -423,51 +423,27 @@ public static void pausar(long pause) {

public static void GUIRun(Runnable r) {

boolean ok;

do {
ok = true;

try {
if (!SwingUtilities.isEventDispatchThread()) {
SwingUtilities.invokeLater(r);
} else {
r.run();
}
} catch (Exception ex) {
ok = false;
Logger.getLogger(MiscTools.class.getName()).log(Level.SEVERE, null, ex);
MiscTools.pausar(250);
}
if (!SwingUtilities.isEventDispatchThread()) {
SwingUtilities.invokeLater(r);
} else {
r.run();
}

} while (!ok);
}

public static void GUIRunAndWait(Runnable r) {

boolean ok;

do {
ok = true;
try {
if (!SwingUtilities.isEventDispatchThread()) {
SwingUtilities.invokeAndWait(r);
} else {
r.run();
}
} catch (Exception ex) {
ok = false;
Logger.getLogger(MiscTools.class.getName()).log(Level.SEVERE, null, ex);
MiscTools.pausar(250);
try {
if (!SwingUtilities.isEventDispatchThread()) {
SwingUtilities.invokeAndWait(r);
} else {
r.run();
}
} while (!ok);
}

public static void threadRun(Runnable r) {
} catch (Exception ex) {

Thread hilo = new Thread(r);
Logger.getLogger(MiscTools.class.getName()).log(Level.SEVERE, null, ex);

hilo.start();
}

}

Expand Down
Binary file modified src/main/resources/images/mbasterd_screen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 646eb6b

Please sign in to comment.