• Smali Javirs


    Smali Javirs


    下载工具转化为java代码

    /**
      * Generated by smali2java 1.0.0.558
      * Copyright (C) 2013 Hensence.com
      */
    
    package net.bluelotus.tomorrow.easyandroid;
    
    import android.util.Base64;
    import java.io.PrintStream;
    import java.security.NoSuchAlgorithmException;
    import javax.crypto.NoSuchPaddingException;
    import java.security.InvalidKeyException;
    import javax.crypto.IllegalBlockSizeException;
    import javax.crypto.BadPaddingException;
    import javax.crypto.spec.SecretKeySpec;
    import javax.crypto.Cipher;
    import java.security.Key;
    import java.security.GeneralSecurityException;
    
    public class Crackme {
        private String str2 = "cGhyYWNrICBjdGYgMjAxNg==";
        
        public Crackme() {
            GetFlag("sSNnx1UKbYrA1+MOrdtDTA==");
        }
        
        private String GetFlag(String p1) {
            byte[] "content" = Base64.decode(p1.getBytes(), 0x0);
            String "kk" = new String(Base64.decode(str2.getBytes(), 0x0));
            System.out.println(decrypt("content", "kk"));
            return null;
        }
        
        private String decrypt(byte[] p1, String p2) {
            String "m" = 0x0;
            try {
                byte[] "keyStr" = p2.getBytes();
                SecretKeySpec "key" = new SecretKeySpec("keyStr", "AES");
                Cipher "cipher" = Cipher.getInstance("AES/ECB/NoPadding");
                "cipher".init(0x2, "key");
                byte[] "result" = "cipher".doFinal(p1);
                return "m";
            } catch(NoSuchPaddingException "e") {
                "e".printStackTrace();
            }
            return  "m";
        }
    }
    
    



    解AES需要导入一个模块(需下载)
    ModuleNotFoundError: No module named 'Crypto'

    解决方法:

    pip install pycryptodome

    当然有可能会出现这种情况:看到报错后是这么安装的:pip install crypto

    但是运行还是报错:ModuleNotFoundError: No module named 'Crypto';
    此时需要去环境中将安装的包crypto的名字改成Crypto,首字母大写;
    然后再次运行,出现这个错误:ModuleNotFoundError: No module named 'Crypto.Cipher'
    此时进入到安装的文件夹下,发现没有此文件:
    需要卸载刚才安装的包:pip uninstall crypto
    然后重新安装:pip install pycryptodome,即可!


    b'PCTF{Sm4liRiver}'

    import base64
    from Crypto.Cipher import AES
    
    key = 'cGhyYWNrICBjdGYgMjAxNg=='
    cipher = 'sSNnx1UKbYrA1+MOrdtDTA=='
    key = base64.b64decode(key)
    cipher = base64.b64decode(cipher)
    AES = AES.new(key,AES.MODE_ECB)
    print(AES.decrypt(cipher))
    
  • 相关阅读:
    利用Apache AXIS 1 发布WebService
    WebService(基于AXIS的WebService编程)
    转载 使用axis2构建webservice
    svn强制解锁的几种做法
    批处理切换当前目录的做法
    Android源码分析-点击事件派发机制
    Eclipse使用技巧总结(六)
    Eclipse使用技巧总结(五)
    Eclipse使用技巧总结(四)——代码重构专题
    Eclipse使用技巧总结(三)
  • 原文地址:https://www.cnblogs.com/serendipity-my/p/13744225.html
Copyright © 2020-2023  润新知