Sybil: Improve family analysis

Increase credit if family sig is verified
Speed up analysis by only looping through RIs once
Add link to all family members
Add SUNYSB certificate
bump -2
This commit is contained in:
zzz
2022-02-25 10:36:17 -05:00
parent 140ab47354
commit dc40755e7c
4 changed files with 70 additions and 24 deletions

View File

@@ -1,3 +1,13 @@
2022-02-25 zzz
* Sybil: Family analysis improvements
2022-02-24 zzz
* SSU: SSU2 classes and keys (WIP)
2022-02-23 zzz
* i2psnark: Load sytem mime types if available
* SSU: More SSU2 prep and support (WIP)
2022-02-22 zzz
* BOB: Remove source
* Crypto: Prep for SSU2

View File

@@ -0,0 +1,14 @@
-----BEGIN CERTIFICATE-----
MIICJDCCAcegAwIBAgIIV98tz0AhW0AwDAYIKoZIzj0EAwIFADBRMR4wHAYDVQQH
ExVJMlAgQW5vbnltb3VzIE5ldHdvcmsxDzANBgNVBAsTBmZhbWlseTEeMBwGA1UE
AxMVU1VOWVNCLmZhbWlseS5pMnAubmV0MB4XDTE4MDUwMjE2NDU1N1oXDTI4MDUw
MTE2NDU1N1owUTEeMBwGA1UEBxMVSTJQIEFub255bW91cyBOZXR3b3JrMQ8wDQYD
VQQLEwZmYW1pbHkxHjAcBgNVBAMTFVNVTllTQi5mYW1pbHkuaTJwLm5ldDBZMBMG
ByqGSM49AgEGCCqGSM49AwEHA0IABOx8/VsK7WtEFzH7lk86KkgUqS8y+oA3yttj
LAjDwXTE/+EGToxqoLUvXsua1o+6A7dXs/Y6TW4dFrz7bUj2nYajgYYwgYMwHQYD
VR0OBBYEFPsIQrbYiC+Y+bJkS2iI921pLi/qMB8GA1UdIwQYMBaAFPsIQrbYiC+Y
+bJkS2iI921pLi/qMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGmMCAG
A1UdEQQZMBeCFVNVTllTQi5mYW1pbHkuaTJwLm5ldDAMBggqhkjOPQQDAgUAA0kA
MEYCIQCoPfvOkq9cuzxweV/7jv/3t94XtMyC7JYlMokdwjDcdAIhAPaBqXGnGE8e
/iLp8pbP2RQIWRK1vGbTXczRGPn//biR
-----END CERTIFICATE-----

View File

@@ -18,7 +18,7 @@ public class RouterVersion {
/** deprecated */
public final static String ID = "Git";
public final static String VERSION = CoreVersion.VERSION;
public final static long BUILD = 1;
public final static long BUILD = 2;
/** for example "-test" */
public final static String EXTRA = "";

View File

@@ -85,6 +85,7 @@ public class Analysis extends JobImpl implements RouterApp {
private static final double POINTS_US24 = 20.0;
private static final double POINTS_US16 = 10.0;
private static final double POINTS_FAMILY = -10.0;
private static final double POINTS_FAMILY_VERIFIED = POINTS_FAMILY * 2;
private static final double POINTS_NONFF = -5.0;
private static final double POINTS_BAD_OUR_FAMILY = 100.0;
private static final double POINTS_OUR_FAMILY = -100.0;
@@ -722,43 +723,64 @@ public class Analysis extends JobImpl implements RouterApp {
}
/**
* @return map of family name to list of routers in that family
* @since 0.9.38 split out from renderIPGroupsFamily()
*/
public Map<String, List<RouterInfo>> calculateIPGroupsFamily(List<RouterInfo> ris, Map<Hash, Points> points) {
ObjectCounter<String> oc = new ObjectCounter<String>();
Map<String, List<RouterInfo>> rv = new HashMap<String, List<RouterInfo>>();
for (RouterInfo info : ris) {
String fam = info.getOption("family");
if (fam == null)
continue;
oc.increment(fam);
List<RouterInfo> fris = rv.get(fam);
if (fris == null) {
fris = new ArrayList<RouterInfo>(4);
rv.put(fam, fris);
}
fris.add(info);
}
List<String> foo = new ArrayList<String>(oc.objects());
Map<String, List<RouterInfo>> rv = new HashMap<String, List<RouterInfo>>(foo.size());
FamilyKeyCrypto fkc = _context.router().getFamilyKeyCrypto();
String ourFamily = fkc != null ? fkc.getOurFamilyName() : null;
for (String s : foo) {
int count = oc.count(s);
List<RouterInfo> list = new ArrayList<RouterInfo>(count);
rv.put(s, list);
for (Map.Entry<String, List<RouterInfo>> e : rv.entrySet()) {
String s = e.getKey();
List<RouterInfo> list = e.getValue();
int count = list.size();
String ss = DataHelper.escapeHTML(s);
for (RouterInfo info : ris) {
String fam = info.getOption("family");
if (fam == null)
continue;
if (!fam.equals(s))
continue;
list.add(info);
double point = POINTS_FAMILY;
if (fkc != null && s.equals(ourFamily)) {
if (fkc.verifyOurFamily(info))
addPoints(points, info.getHash(), POINTS_OUR_FAMILY, "Our family \"" + ss + "\" with " + (count - 1) + " other" + (( count > 2) ? "s" : ""));
else
addPoints(points, info.getHash(), POINTS_BAD_OUR_FAMILY, "Spoofed our family \"" + ss + "\" with " + (count - 1) + " other" + (( count > 2) ? "s" : ""));
for (RouterInfo info : list) {
double point;
String reason;
if (fkc != null) {
if (s.equals(ourFamily)) {
if (fkc.verifyOurFamily(info)) {
point = POINTS_OUR_FAMILY;
reason = "Our family \"" + ss + "\" with <a href=\"/netdb?fam=" + ss + "&amp;sybil\">" + (count - 1) + " other" + (( count > 2) ? "s" : "") + "</a>";
} else {
point = POINTS_BAD_OUR_FAMILY;
reason = "Spoofed our family \"" + ss + "\" with <a href=\"/netdb?fam=" + ss + "&amp;sybil\">" + (count - 1) + " other" + (( count > 2) ? "s" : "") + "</a>";
}
} else {
if (fkc.verify(info)) {
point = POINTS_FAMILY_VERIFIED;
if (count > 1)
reason = "In verified family \"" + ss + "\" with <a href=\"/netdb?fam=" + ss + "&amp;sybil\">" + (count - 1) + " other" + (( count > 2) ? "s" : "") + "</a>";
else
reason = "In verified family \"" + ss + '"';
} else {
point = POINTS_FAMILY;
if (count > 1)
reason = "In unverified family \"" + ss + "\" with <a href=\"/netdb?fam=" + ss + "&amp;sybil\">" + (count - 1) + " other" + (( count > 2) ? "s" : "") + "</a>";
else
reason = "In unverified family \"" + ss + '"';
}
}
} else if (count > 1) {
addPoints(points, info.getHash(), point, "In family \"" + ss + "\" with " + (count - 1) + " other" + (( count > 2) ? "s" : ""));
point = POINTS_FAMILY;
reason = "In unverified family \"" + ss + "\" with <a href=\"/netdb?fam=" + ss + "&amp;sybil\">" + (count - 1) + " other" + (( count > 2) ? "s" : "") + "</a>";
} else {
addPoints(points, info.getHash(), point, "In family \"" + ss + '"');
point = POINTS_FAMILY;
reason = "In unverified family \"" + ss + '"';
}
addPoints(points, info.getHash(), point, reason);
}
}
return rv;