Skip to content

Instantly share code, notes, and snippets.

@waylife
Last active July 9, 2023 10:49
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save waylife/b4d3e24b1ac0fe75e6f6e2bc4aa7e715 to your computer and use it in GitHub Desktop.
Save waylife/b4d3e24b1ac0fe75e6f6e2bc4aa7e715 to your computer and use it in GitHub Desktop.
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
Copy link
Author

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