Skip to content

Instantly share code, notes, and snippets.

@waylife
Last active Mar 26, 2020
Embed
What would you like to do?
HG261GSDecoder for FiberHome HG261
public class HG261GSDecoder {
public static void main(String[] args) {
System.out.println("HG261GSDecoder v0.0.1(20160914) By RxRead");
System.out.println("http://blog.zanlabs.com");
// baseinfoSet_USERPASSWORD
String cipherText = "66&85&55&102&79&";
System.out.println(String.format("ciphertext=%s\ndecoder text=%s", cipherText, getPassword(cipherText)));
// http://192.168.1.1/cgi-bin/baseinfoSet.cgi,baseinfoSet_TELECOMPASSWORD
String cipherText2 = "120&105&112&105&103&115&113&101&104&113&109&114&57&56&50&49&49&54&50&49&";
System.out.println(String.format("ciphertext=%s\ndecoder text=%s", cipherText2, getPassword(cipherText2)));
}
public static String getPassword(String cipherText) {
if (cipherText == null || cipherText.length() == 0) {
return "";
}
if (cipherText.charAt(cipherText.length() - 1) == '&') {
cipherText = cipherText.substring(0, cipherText.length() - 1);
}
String[] orgArr = cipherText.split("&");
StringBuffer sb = new StringBuffer();
int count = 0;
for (String str : orgArr) {
int intValue = Integer.parseInt(str);
if (intValue >= 48 && intValue <= 57) {
intValue = intValue;
} else {
intValue -= 4;
}
String value = new String(new byte[] { (byte) (intValue) });
sb.append(new String(value));
count++;
}
return sb.toString();
}
}
@waylife

This comment has been minimized.

Copy link
Owner Author

@waylife waylife commented May 17, 2018

备注,烽火路由器 后台密码规则(加密版)
非加密版规则https://www.douban.com/note/517148856/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment