IT数码 购物 网址 头条 软件 日历 阅读 图书馆
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
图片批量下载器
↓批量下载图片,美女图库↓
图片自动播放器
↓图片自动播放器↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁
 
   -> C++知识库 -> 编码分析(持续更新) -> 正文阅读

[C++知识库]编码分析(持续更新)

作者:token macro property

猫咪和键盘

题目地址 : https://ce.pwnthebox.com/challenges?type=1&page=1&diff=medium&id=452
纵向随机切割

with open("typed_printf.cpp","r") as f:
    lines=f.readlines()
    #print(lines)
    for line in lines:
        seg1=line[0:1]
        seg2=line[1:7]
        seg3=line[8:20]
        seg4=line[20:22]
        seg5=line[22:32]
        seg6=line[32:39]
        seg7=line[39:-1]
        print((seg1+seg6+seg2+seg4+seg3+seg5+seg7).strip())
/*
* name: typed_printf.cpp
* compile: g++ -std=c++17 typed_printf.cpp
* title: type safe printf
* author: nicekingwei
* url: aHR0cHM6Ly96anUtbGFtYmRhLnRlY2gvY3BwZHQtcHJpbnRmLw==
* related knowledge:
*  - value and type
*      value->value: function
*      type->value: parametric polymorphism
*      type->type: generic
*      value->type: dependent type
*  - auto
*  - if constexpr
*/
#include 
#include 
#include 

using namespace std;

template
static auto println() {
if constexpr (format[0]=='%') {
if constexpr (format[1]=='d') {
return [](int x){cout<
constexpr auto get_arg(R (*f)(T)){
return T{};
}

template
constexpr bool cont_takes_no_arg(T cont){
using cont_t = decay_t;
using arg_type = decay_t;
return is_same::value;
}


template
auto print_var(T x){
cout<
auto print_var(T x){
cout<
auto print_const(X x){
cout<
auto print_const(){
cout<
constexpr auto cont_ret_type(R (*cont)(X)){
return R{};
}

template
constexpr auto cont_ret_type(R (*cont)()){
return R{};
}

template
constexpr auto cont_arg_type(R (*cont)(X)){
return X{};
}

template
constexpr auto cont_arg_type(R (*cont)()){
return unit_t{};
}

unit_t print_nothing(){return unit_t{};}

#define cont_ret_t decay_t
#define cont_arg_t decay_t

template
constexpr auto _typed_printf(){
if constexpr (format[i]=='%' && format[i+1] == 'd') {
constexpr auto cont = _typed_printf();
return print_var;
} else if constexpr (format[i]=='%' && format[i+1] == 's') {
constexpr auto cont = _typed_printf();
return print_var;
} else if constexpr (format[i]!='\0') {
constexpr auto cont = _typed_printf();
return print_const;
} else {
return print_nothing;
}
}

#define def_typed_printf(f,str) constexpr static const char str_fmt##f[] = str; auto f = _typed_printf();

#define ABC "FfQ47if9Zxw9jXE68VtGA"
#define BAC "JDk6Y6Xc88UrUtpK3iF8p"
#define CAB "7BMs4y2gzdG8Ao2gv6aiJ"

int main(){
def_typed_printf(f_l_x_g_1, "%s%s%s%s");
f_l_x_g_1("fl")("a")("g")("{");
def_typed_printf(a_a_a_a_a_a_a_a_a, "%s%s%s%s%s%s%d");
a_a_a_a_a_a_a_a_a(ABC)("")(BAC)("")(CAB)("")('}');
def_typed_printf(def_typed_printf_, "%s%d%s");
def_typed_printf_("typed_printf")('_')("}");
return 0;
}

c++17运行得flag
在这里插入图片描述

Quotes

题目地址 : https://ce.pwnthebox.com/challenges?type=1&page=6&id=973

My+mission+in+life+is+not+mer ely+to+survive+but
to+thrive+and+to+do+so+w ith+s ome+pass i on+some+compass ion+so
me+humor+and+some+style
英文句子有加号有空格,按空格分组,计算字母数量然后对照26英文字母表输出文字

import string
l1="My+mission+in+life+is+not+mer ely+to+survive+but to+thrive+and+to+do+so+w ith+s  ome+pass i on+some+compass ion+so me+humor+and+some+style".split(' ')

l2 = [len(i) - i.count('+') for i in l1]
l3 = [len(i) for i in l1]
print(l2)

cs = [string.ascii_lowercase[i-1] if i > 0 else ' ' for i in l2]
print(cs)
print(''.join(cs)) # flag

你猜猜

题目地址 : https://adworld.xctf.org.cn/task/answer?type=crypto&number=5&grade=1&id=4930&page=1
在这里插入图片描述
另出为zip文件,打开发现需要输入密码
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

0和1的故事

题目地址 : https://ce.pwnthebox.com/challenges?type=1&page=1&diff=easy&id=79

flag为16进制字符串

s1='09 20 20 09 20 09 20 09 09 20 09 20 09 20 09 09 20 20 09 20 20 09 09 09 20 20 20 09 09 09 20 09 20 09 20 09 09 09 09 20 20 20 20 09 09 09 20 09 09 09 09 09 09 20 20 20 20 20 20'
res1 = ''
ls2 = s1.split(' ')
print(len(s1))
print(len(ls2))
for i in ls2:
    if '09'==i:
        res1 += '1'
    elif '20'==i:
        res1 += '0'
print(res1)
print(hex(int(res1,2)))
  C++知识库 最新文章
【C++】友元、嵌套类、异常、RTTI、类型转换
通讯录的思路与实现(C语言)
C++PrimerPlus 第七章 函数-C++的编程模块(
Problem C: 算法9-9~9-12:平衡二叉树的基本
MSVC C++ UTF-8编程
C++进阶 多态原理
简单string类c++实现
我的年度总结
【C语言】以深厚地基筑伟岸高楼-基础篇(六
c语言常见错误合集
上一篇文章      下一篇文章      查看所有文章
加:2022-05-21 18:44:48  更:2022-05-21 18:47:05 
 
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁

360图书馆 购物 三丰科技 阅读网 日历 万年历 2024年5日历 -2024/5/13 4:36:51-

图片自动播放器
↓图片自动播放器↓
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
图片批量下载器
↓批量下载图片,美女图库↓
  网站联系: qq:121756557 email:121756557@qq.com  IT数码