题目链接: http://ctf.idf.cn/index.php?g=game&m=article&a=index&id=43

知识点:js语法

这里这里→ http://ctf.idf.cn/game/web/43/index.php

思路:

查看网页源码,阅读js代码,发现函数实现了加密方法,但是解密的方法并没有实现,根据加密的部分我们容易写出解密的方法,如下:

<html>
<body> <script>
/**
* Pseudo md5 hash function
* @param {string} string
* @param {string} method The function method, can be 'ENCRYPT' or 'DECRYPT'
* @return {string}
*/
function pseudoHash(string, method) {
// Default method is encryption
if (!('ENCRYPT' == method || 'DECRYPT' == method)) {
method = 'ENCRYPT';
}
// Run algorithm with the right method
if ('ENCRYPT' == method) {
// Variable for output string
var output = '';
// Algorithm to encrypt
for (var x = 0, y = string.length, charCode, hexCode; x < y; ++x) {
charCode = string.charCodeAt(x);
if (128 > charCode) {
charCode += 128;
} else if (127 < charCode) {
charCode -= 128;
}
charCode = 255 - charCode;
hexCode = charCode.toString(16);
if (2 > hexCode.length) {
hexCode = '0' + hexCode;
} output += hexCode;
}
// Return output
return output;
} else if ('DECRYPT' == method) {
// Algorithm to encrypt
// Variable for output string
var output = '';
var charCode = '';
var hexCode = 0;
for(var i=0; i<string.length; i+=2){
if(string[i] == '0'){
charCode = string[i+1];
}
else{
charCode = string[i]+string[i+1];
} hexCode = parseInt(charCode, 16)
hexCode = 255 - hexCode
if(hexCode > 128){
hexCode -= 128
}
else if(hexCode < 128){
hexCode += 128
}
output += String.fromCharCode(hexCode);
}
// Return output
return output;
}
}
document.write(pseudoHash('46191d4b494a4e1c4f4a1d4d1a1b484f191d1e4a1e191a4f1d4f4c461e4a4a4f', 'DECRYPT'));
</script> </body>
</html>

解密的结果为“9fb4651c05b2ed70fba5afe0b039a550”,将该值粘入原网页的密码输入框,走你,得到答案“wctf{jS_decRypt__Eaaasy}”

IDF-CTF-简单的js加密 writeup的更多相关文章

  1. IDF-CTF-不难不易的js加密 writeup

    题目链接: http://ctf.idf.cn/index.php?g=game&m=article&a=index&id=28 就是这里 → http://ctf.idf.c ...

  2. IDF实验室-简单编程-字符统计 writeup

    题目地址:http://ctf.idf.cn/index.php?g=game&m=article&a=index&id=37 网站:http://ctf.idf.cn/gam ...

  3. IDF实验室-简单的ELF逆向 writeup

    题目:http://ctf.idf.cn/index.php?g=game&m=article&a=index&id=39 下载得到ElfCrackMe1文件,直接用IDA打开 ...

  4. IDF实验室-简单的js解密

    根据加密方法推算解密方法,补全如下 <script> /** * Pseudo md5 hash function * @param {string} string * @param {s ...

  5. Python 爬虫js加密破解(四) 360云盘登录password加密

    登录链接:https://yunpan.360.cn/mindex/login 这是一个md5 加密算法,直接使用 md5加密即可实现 本文讲解的是如何抠出js,运行代码 第一部:抓包 如图 第二步: ...

  6. 翻译小工具制作,Python简单破解有道JS加密!

    写这篇文章之前,我记得我以前好像公布一次.百度翻译的接口把版本号修改可以得到老版本,而老版本是没JS加密的,有道的呢也是一样的. ! 不过今天的教程不会这么low,咱们今天就老老实实把有道翻译的JS破 ...

  7. 简单的Elf逆向Writeup

    ElfCrackMe1 html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acrony ...

  8. AES加密解密——AES在JavaWeb项目中前台JS加密,后台Java解密的使用

    一:前言 在软件开发中,经常要对数据进行传输,数据在传输的过程中可能被拦截,被监听,所以在传输数据的时候使用数据的原始内容进行传输的话,安全隐患是非常大的.因此就要对需要传输的数据进行在客户端进行加密 ...

  9. 使用Z3破解简单的XOR加密

    使用Z3破解简单的XOR加密 翻译:无名侠 原文地址: https://yurichev.com/blog/XOR_Z3/ 如果我们有一段用简单XOR加密过的文本,怎么寻找密钥呢?密钥的长度可能很长, ...

随机推荐

  1. python 字符串 string模块导入及用法

    字符串也是一个模块,有自己的方法,可以通过模块导入的方式来调用 1,string模块导入 import string 2,  其用法 string.ascii_lowercase string.dig ...

  2. python学习第四十五天__name__用法和作用

    在python导入模块导入另外一个模块的时候,有时候只是想用其一个方法,会出现其他的方法也运行了,python用到__name__==‘__main__’ 解决问题,那么__name__用法和作用 1 ...

  3. 树莓派VNC Viewer 远程桌面配置教程

    作为一个刚入门的小白,你还在为如何配置树莓派的远程桌面控制苦恼? 是否希望能够每次在树莓派上无须接上显示器.键盘.鼠标以及走到放置你的树莓派的地方就可以运行指令! 在这篇树莓派文章中,你将学到如何在树 ...

  4. 帝国CMS自定义页面的添加与目录式链接的处理

    需求: 1.将某一本地前端自定义页面模板,导入到帝国系统,应用到网站 2.将导入的页面在站点中打开为目录式链接 www.abc.com/softlink/ 环境: 1.windows服务器 2.帝国C ...

  5. webpack之给目录起别名

    1. 配置文件目录: build>webpack.base.config.js: resolve: { alias: { '@': resolve('src'), //照猫画虎 'styles' ...

  6. slot-scope 插槽 的使用 ——'<template slot-scope="page">'

    slot-scope="page"slot-scope 是一个插槽,拿外面的数据,可以获取当前一行的数据page.row.pageId 拿到当前行数据的pageId注意:slot- ...

  7. JFreeChart与struts2整合实例

    1. 3个jar包 jcommon,jfreechart,strust2-jfreechart-plugin 2 <?xml version="1.0" encoding=& ...

  8. sqli-5&6

    第五关 Double Injection - Single Quotes - String (双注入GET单引号字符型注入) 1.发现前几关的方法都不能用了,要么报错(没有其他有关信息.要么什么也不出 ...

  9. java 生成时机时间

    import java.text.SimpleDateFormat;  import java.util.Date;  import java.util.Random;  public class t ...

  10. 装饰器模式-Decerator

    一.定义 装饰器模式又叫做包装模式(Wrapper).装饰器模式以对客户端透明的方式扩展对象的功能,是继承关系的一个替代方案. 在以下情况下应该使用装饰器模式: 1.需要扩展一个类的功能,或给一个类增 ...