Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

- Nothing yet
### Fixed

- ISD-AS assignment parser broken after website change
[#12](https://github.com/netsec-ethz/scion-java-multiping/pull/12)

## [0.4.0] - 2025-04-04

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
<dependency>
<groupId>org.scion</groupId>
<artifactId>jpan</artifactId>
<version>0.5.1</version>
<version>0.5.3</version>
</dependency>

<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,15 @@
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.scion.jpan.ScionUtil;

public class DownloadAssignmentsFromWeb {
private static final String HTTPS_URL =
"https://docs.anapaya.net/en/latest/resources/isd-as-assignments/";
"https://docs.anapaya.net/en/latest/resources/isd-as-assignments/";

public static void main(String[] args) throws IOException {
new DownloadAssignmentsFromWeb().jsoup();
Expand All @@ -42,22 +43,26 @@ public static List<ParseAssignments.HostEntry> getList() {
public List<ParseAssignments.HostEntry> jsoup() throws IOException {
List<ParseAssignments.HostEntry> result = new ArrayList<>(100);
Document doc = Jsoup.connect(HTTPS_URL).get();
for (Element bc : doc.body().getElementsByAttributeValue("id", "isd-membership")) {
// System.out.println("eee " + bc);
for (Element bc2 : bc.getElementsByTag("tbody")) {
// System.out.println("eee2 " + bc2);
for (Element bc3 : bc2.children()) {
// System.out.println("eee3 " + bc3);
String isdAs = bc3.child(0).getElementsByTag("p").text();
String name = bc3.child(1).getElementsByTag("p").text();
// System.out.println(isdAs + " " + name);
result.add(new ParseAssignments.HostEntry(ScionUtil.parseIA(isdAs), name));
// for (Element bc4 : bc3.children()) {
// System.out.println("eee4 " + bc4.getElementsByTag("p").text());
// }

for (Element table : doc.getElementsByTag("table")) {
for (Element isd_as : table.getElementsContainingText("ISD-AS")) {
if ("table".equals(isd_as.tagName())) {
for (Element te : table.children()) {
if ("thead".equals(te.tagName())) {
continue;
}
for (Element te2 : te.children()) {
// System.out.println(" te3: " + te2.tag());
String isdAs = te2.child(0).getElementsByTag("td").text();
String name = te2.child(1).getElementsByTag("td").text();
// System.out.println(isdAs + " " + name);
result.add(new ParseAssignments.HostEntry(ScionUtil.parseIA(isdAs), name));
}
}
}
}
}

return result;
}
}