Skip to content

Commit

Permalink
Update ZoomEyeClient.java
Browse files Browse the repository at this point in the history
  • Loading branch information
bit4woo committed Oct 31, 2024
1 parent da6e763 commit adb0954
Showing 1 changed file with 50 additions and 31 deletions.
81 changes: 50 additions & 31 deletions src/InternetSearch/Client/ZoomEyeClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,45 +55,60 @@ public List<SearchResultEntry> parseResp(String respbody) {
}
}

JSONObject portinfo = null;
try {
// port
int port = entryitem.getJSONObject("portinfo").getInt("port");
entry.setPort(port);
// protocol
String serviceName = entryitem.getJSONObject("portinfo").getString("service");
entry.setProtocol(serviceName);
} catch (Exception e4) {
//org.json.JSONException: JSONObject["portinfo"] not found.
//e4.printStackTrace();
portinfo = entryitem.getJSONObject("portinfo");
} catch (Exception e) {

}

// title
try {
String title = entryitem.getJSONObject("portinfo").getString("title");
if (title != null) {
entry.setTitle(title);
if (portinfo != null) {
try {
// port
int port = entryitem.getJSONObject("portinfo").getInt("port");
entry.setPort(port);
// protocol
String serviceName = entryitem.getJSONObject("portinfo").getString("service");
entry.setProtocol(serviceName);
} catch (Exception e4) {
// org.json.JSONException: JSONObject["portinfo"] not found.
// e4.printStackTrace();
}
} catch (Exception e) {

// title
try {
JSONArray titleArray = entryitem.getJSONObject("portinfo").getJSONArray("title");
if (titleArray != null) {
entry.setTitle(titleArray.getString(0));
String title = entryitem.getJSONObject("portinfo").getString("title");
if (title != null) {
entry.setTitle(title);
}
} catch (Exception e1) {
} catch (Exception e) {
try {
String title = entryitem.getString("title");
if (title != null) {
entry.setTitle(title);
JSONArray titleArray = entryitem.getJSONObject("portinfo").getJSONArray("title");
if (titleArray != null) {
entry.setTitle(titleArray.getString(0));
}
} catch (Exception e2) {
try {
JSONArray titleArray = entryitem.getJSONArray("title_list");
if (titleArray != null) {
entry.setTitle(titleArray.getString(0));
}
} catch (Exception e3) {
e3.printStackTrace();
} catch (Exception e1) {

}
}
}

// title
if (StringUtils.isEmpty(entry.getTitle())) {

try {
String title = entryitem.getString("title");
if (title != null) {
entry.setTitle(title);
}
} catch (Exception e2) {
try {
JSONArray titleArray = entryitem.getJSONArray("title_list");
if (titleArray != null) {
entry.setTitle(titleArray.getString(0));
}
} catch (Exception e3) {
// e3.printStackTrace();
}
}
}
Expand All @@ -120,11 +135,15 @@ public List<SearchResultEntry> parseResp(String respbody) {
}
return result;
}
} catch (Exception e) {
} catch (

Exception e) {
e.printStackTrace(stderr);
}

printDebugInfo();
return result;

}

public static Set<String> getIPSet(JSONObject entryitem) {
Expand Down

0 comments on commit adb0954

Please sign in to comment.