• Stars
    star
    386
  • Rank 110,873 (Top 3 %)
  • Language
    Python
  • License
    MIT License
  • Created almost 5 years ago
  • Updated over 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

PHPFuck: ([+.^]) / Using only 7 different characters to write and execute php.

PHPFuck: ([+.^])

Using only 7 different characters to write and execute php.

Only support PHP 7+ currently.

Example Code

The following source will execute phpinfo();:

<?php 
  ((([]^[]).[][[]]^([]^[[]])+([]^[[]]).[][[]]^([].[])[([]^[[]])+([]^[[]])+([]^[[]])]).(([].[])[([]^[[]])]).(([
  ]^[]).[][[]]^([]^[[]])+([]^[[]])+([]^[[]])+([]^[[]]).[][[]]^([].[])[([]^[[]])+([]^[[]])+([]^[[]])]).(([].[])
  [([]^[[]])+([]^[[]])+([]^[[]])]).(([]^[[]])+([]^[[]])+([]^[[]])+([]^[[]])+([]^[[]]).[][[]]^([].[])[([]^[])])
  .(([]^[]).[][[]]^([]^[[]])+([]^[[]])+([]^[[]])+([]^[[]]).[][[]]^([].[])[([]^[[]])+([]^[[]])+([]^[[]])]).(([]
  ^[[]])+([]^[[]])+([]^[[]])+([]^[[]])+([]^[[]]).[][[]]^([].[])[([]^[[]])]^([].[])[([]^[[]])+([]^[[]])+([]^[[]
  ])]^([].[])[([]^[[]])+([]^[[]])+([]^[[]])+([]^[[]])]).(([]^[[]])+([]^[[]])+([]^[[]])+([]^[[]]).[][[]]^([].[]
  )[([]^[])]^([].[])[([]^[[]])]^([].[])[([]^[[]])+([]^[[]])+([]^[[]])]).(([]^[[]])+([]^[[]])+([]^[[]])+([]^[[]
  ]).[][[]]^([].[])[([]^[])]).(([]^[]).[][[]]^([]^[[]])+([]^[[]])+([]^[[]])+([]^[[]]).[][[]]^([].[])[([]^[[]])
  ]^([].[])[([]^[[]])+([]^[[]])+([]^[[]])]^([].[])[([]^[[]])+([]^[[]])+([]^[[]])+([]^[[]])]).(([]^[]).[][[]]^(
  []^[[]])+([]^[[]]).[][[]]^([].[])[([]^[[]])+([]^[[]])+([]^[[]])]).(([]^[[]])+([]^[[]])+([]^[[]])+([]^[[]])+(
  []^[[]]).[][[]]^([].[])[([]^[])]).(([]^[]).[][[]]^([].[])[([]^[])]^([].[])[([]^[[]])+([]^[[]])+([]^[[]])]^([
  ].[])[([]^[[]])+([]^[[]])+([]^[[]])+([]^[[]])]).(([]^[[]])+([]^[[]])+([]^[[]])+([]^[[]])+([]^[[]])+([]^[[]])
  .[][[]]^([].[])[([]^[])]^([].[])[([]^[[]])+([]^[[]])+([]^[[]])]^([].[])[([]^[[]])+([]^[[]])+([]^[[]])+([]^[[
  ]])]).(([]^[]).[][[]]^([]^[[]])+([]^[[]])+([]^[[]])+([]^[[]]).[][[]]^([].[])[([]^[[]])]^([].[])[([]^[[]])+([
  ]^[[]])+([]^[[]])]^([].[])[([]^[[]])+([]^[[]])+([]^[[]])+([]^[[]])]))(...((([]^[[]])+([]^[[]]).[][[]]^([].[]
  )[([]^[])]).(([]^[[]])+([]^[[]])+([]^[[]])+([]^[[]])+([]^[[]]).[][[]]^([].[])[([]^[])]).(([].[])[([]^[[]])])
  .(([]^[[]])+([]^[[]])+([]^[[]])+([]^[[]])+([]^[[]]).[][[]]^([].[])[([]^[[]])]^([].[])[([]^[[]])+([]^[[]])+([
  ]^[[]])]^([].[])[([]^[[]])+([]^[[]])+([]^[[]])+([]^[[]])]).(([]^[[]])+([]^[[]]).[][[]]^([]^[[]])+([]^[[]])+(
  []^[[]])+([]^[[]]).[][[]]^([].[])[([]^[[]])+([]^[[]])+([]^[[]])]).(([]^[]).[][[]]^([]^[[]])+([]^[[]])+([]^[[
  ]])+([]^[[]]).[][[]]^([].[])[([]^[[]])+([]^[[]])+([]^[[]])]).(([]^[[]])+([]^[[]])+([]^[[]])+([]^[[]])+([]^[[
  ]]).[][[]]^([].[])[([]^[])]).(([]^[]).[][[]]^([]^[[]])+([]^[[]]).[][[]]^([].[])[([]^[[]])+([]^[[]])+([]^[[]]
  )]).(([]^[[]])+([]^[[]]).[][[]]^([].[])[([]^[])]).(([]^[]).[][[]]^([]^[[]])+([]^[[]])+([]^[[]])+([]^[[]]).[]
  [[]]^([].[])[([]^[[]])]))((([]^[[]])+([]^[[]])+([]^[[]])+([]^[[]]).[][[]]^([].[])[([]^[[]])+([]^[[]])+([]^[[
  ]])]^([].[])[([]^[[]])+([]^[[]])+([]^[[]])+([]^[[]])]).(([]^[[]]).[][[]]^([].[])[([]^[[]])]^([].[])[([]^[[]]
  )+([]^[[]])+([]^[[]])]).(([]^[[]]).[][[]]^([].[])[([]^[])]).(([]^[[]]).[][[]]^([].[])[([]^[])]^([].[])[([]^[
  []])+([]^[[]])+([]^[[]])]^([].[])[([]^[[]])+([]^[[]])+([]^[[]])+([]^[[]])]).(([]^[[]]).[][[]]^([].[])[([]^[]
  )]).(([]^[]).[][[]]^([].[])[([]^[])]^([].[])[([]^[[]])+([]^[[]])+([]^[[]])]^([].[])[([]^[[]])+([]^[[]])+([]^
  [[]])+([]^[[]])]).(([]^[]).[][[]]^([]^[[]])+([]^[[]])+([]^[[]])+([]^[[]]).[][[]]^([].[])[([]^[[]])]^([].[])[
  ([]^[[]])+([]^[[]])+([]^[[]])]^([].[])[([]^[[]])+([]^[[]])+([]^[[]])+([]^[[]])]).(([]^[[]])+([]^[[]])+([]^[[
  ]])+([]^[[]]).[][[]]^([].[])[([]^[])]^([].[])[([]^[[]])]^([].[])[([]^[[]])+([]^[[]])+([]^[[]])]).(([]^[[]])+
  ([]^[[]])+([]^[[]])+([]^[[]])+([]^[[]])+([]^[[]]).[][[]]^([].[])[([]^[])]^([].[])[([]^[[]])+([]^[[]])+([]^[[
  ]])]^([].[])[([]^[[]])+([]^[[]])+([]^[[]])+([]^[[]])]).(([]^[]).[][[]]^([].[])[([]^[[]])+([]^[[]])+([]^[[]])
  ]^([].[])[([]^[[]])+([]^[[]])+([]^[[]])+([]^[[]])]).(([]^[[]]).[][[]]^([].[])[([]^[[]])+([]^[[]])+([]^[[]])]
  ^([].[])[([]^[[]])+([]^[[]])+([]^[[]])+([]^[[]])]).(([]^[]).[][[]]^([].[])[([]^[[]])]^([].[])[([]^[[]])+([]^
  [[]])+([]^[[]])+([]^[[]])]).(([]^[[]]).[][[]]^([].[])[([]^[[]])]^([].[])[([]^[[]])+([]^[[]])+([]^[[]])])))()
?>

Usage

usage: phpfuck.py [-h] [-O FILE] [-P] [-E {assert,create_function}] code

positional arguments:
  code                  any string to encode.

optional arguments:
  -h, --help            show this help message and exit
  -O FILE, --output-file FILE
                        write encoded string into some file.
  -P, --plain-string    encode as plain string (without eval it).
  -E {assert,create_function}, --eval {assert,create_function}
                        choose eval mode. (`assert` mode only support PHP < 7.1)

You can just use it like this: python3 phpfuck.py "system('id');"

Arguments

  • code (required)
    • Any string or php code to encode.
  • -O, --output-file
    • Write encoded string into some file.
  • -P, --plain-string
    • Encode as plain string (without eval it).
    • With this argument, I will not wrap your code into assert or create_function to eval.
  • -E, --eval
    • You can choose your eval mode!
    • create_function mode (default)
      • create_function('', YOUR_CODE)();
    • assert mode
      • Only support PHP < 7.1 (=7.0.x).
      • assert( '(function(){ YOUR_CODE; return 1; })()' );

TODO

  • Support characters other than ASCII range.
  • Don't use deprecated feature. (create_function has been DEPRECATED)
  • Web interface. (https://splitline.github.io/PHPFuck/)
  • Compatible with PHP 8
    • Maybe string mode only, since the create_function has been removed from PHP 8 :(

More Repositories

1

How-to-Hack-Websites

開源的正體中文 Web Hacking 學習資源 - 程式安全 2021 Fall
PHP
488
star
2

Pickora

A toy compiler that can convert Python scripts 🐍 to pickle bytecode 🥒
Python
110
star
3

My-CTF-Challenges

🏴 🏴 🏴
Python
99
star
4

domain-obfuscator

Make your domain weird, but still works :/
JavaScript
81
star
5

FormosanLanguages.h

讓您輕鬆用原住民語寫程式!
C
58
star
6

emina-one

anime1.me 開站了!但本 app 還沒修好 / 一個 Anime1.me 的非官方 app (ˊ・ω・ˋ)
JavaScript
36
star
7

DOM-Clobber3r

Generate DOM clobbering attack vectors for you.
HTML
29
star
8

awesome-web-security-paper

📝 Web security related academic papers collection (just for myself).
20
star
9

NYCU-Advanced-UNIX-Programming-2021

大家快來抄作業 | 陽明交大高等 UNIX 程式設計
C++
20
star
10

NCTUwU

交大選課模擬器 / NCTU course selection simulator.
JavaScript
18
star
11

py-sandbox-escape

Jailbreaker!!!
Python
16
star
12

AnimateGamerPlus

方便使用巴哈動畫瘋的輔助瀏覽器外掛。
JavaScript
14
star
13

Taiwan-Tech-GPA-Saviour

拯救你ㄉGPA / 快速查詢台科歷年課程的成績分布
HTML
14
star
14

NTUSTapp

一個屬於台科人的 App。
JavaScript
13
star
15

genius-url

A URL builder for genius :D
Python
12
star
16

buddymeter-cheater

buddymeter.com 外掛。讓你能手動定義Buddy meter的分數,並能自動答對所有題目。
JavaScript
9
star
17

Imgura-Final-EOF2022

A&D challenge for AIS3 EOF CTF 2022 Final.
PHP
7
star
18

CTFd-Attack-and-Defense-Plugin

HTML
7
star
19

2015-winter-club-training

資安Demo@2015電資寒訓冬資戀
PHP
7
star
20

wikiart-downloader

Automatically download all the art works in WikiAart. / 自動化下載 www.wikiart.org 的所有畫作。
Python
6
star
21

taiwan-tech-empty-classroom

協助台科同學查詢目前的空教室。
HTML
5
star
22

taiwan-tech-scripts

給台科學生用的實用腳本 / Useful scripts for Taiwan Tech students.
HTML
5
star
23

107-SE-HW1

軟體工程作業 - phonebook
Java
4
star
24

CYSH-Web

嘉中簡化版校網(由於校網更新,現今部分功能失效)
JavaScript
3
star
25

me

About me.
HTML
2
star
26

course.taiwan-te.ch

Python
2
star
27

map2src

Convert source map to original JavaScript.
Python
2
star
28

crosslink-hacking

COOL!
1
star
29

Ptt-X

讓你直接在 ptt.cc 網頁上登入帳號,輕鬆瀏覽 Ptt
JavaScript
1
star
30

NTUST-CourseHelper

一個協助台科人選課的小工具。
JavaScript
1
star
31

Lab-of-Computer-Programming-Final

程式設計實習期末考題庫 個人解法
C++
1
star