'분류 전체보기'에 해당되는 글 168건

  1. 2019.04.21 IDA Ylight.py
  2. 2017.07.13 VirtualBox-Windbg Remote Kernel Debug 1
  3. 2017.06.29 security research blog
  4. 2017.06.28 비트코인 블록 탐색 서비스
  5. 2017.06.28 동적 분석 서비스
  6. 2017.06.27 REST API in php
  7. 2017.06.27 git 관련 자료 모음
  8. 2017.06.27 Creating a simple REST API in PHP
  9. 2017.06.26 bitbucket & github 비교 1
  10. 2017.05.02 instant debugger

IDA Ylight.py

gravity-free 2019. 4. 21. 21:47
from idautils import *
from idc import *

hightCall = []
hightXor = []

heads = Heads(SegStart(ScreenEA()), SegEnd(ScreenEA()))

for i in heads:
	if (GetMnem(i) == "call"):
		hightCall.append(i)
	else :
		if (GetMnem(i) == "xor"):
			if (GetMnem(i+1 == "inc"):
				if (GetMnem(i+2 == "cmp"):
					hightXor.append(i)
		
for i in hightCall:
	SetColor(i, CIC_ITEM, 0xC7FDFF)
	
for i in hightXor:
	SetColor(i, CIC_ITEM, 0xC7C7FF)

 

'gravity-free' 카테고리의 다른 글

security research blog  (0) 2017.06.29
:

VirtualBox-Windbg Remote Kernel Debug

gravity-free/windbg 2017. 7. 13. 15:41


VirtualBox 다운로드 http://www.virtualbox.org/wiki/Downloads
WinDBG 다운로드 http://www.microsoft.com/whdc/devtools/debugging/installx86.mspx

원격 디버깅을 하기 위해는 2대의 PC가 필요한대 하나는 Debugger 이고 하나는 Debuggee 라 합니다.

여기서 설명할 방법은 1대의 PC에 VirtualBox로 가상 윈도우를 설치하여 사용하는 방법입니다.


그럼 본론으로 들어가서 가상 윈도우를 설치했거나 설치할 VirtualBox에 그림처럼 시리얼 포트를 추가합니다.
 



이제 가상 윈도우가 디버그 모드로 부팅하기 위한 작업을 해줘야합니다.

XP 이하 운영체제일 경우:



Boot.ini 를 수정해줘야 합니다. 

다음과 같이 /debug를 추가하면 디버그 모드로 부팅할 수 있습니다.
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="WinDBG Remote Debugging Mode" /fastdetect /debug

두 컴퓨터가 시리얼 포트로 연결되어 있으면 다음과 같은 줄을 추가한다.
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="WinDBG Remote Debugging Mode" /fastdetect /debug /debugport=COM1 /baudrate=115200.


Vista 이상 운영체제일 경우:



msconfig 를 사용하여 설정할수도 있고 아래처럼 bcdedit 를 사용해도됩니다.

참고로 전 bcdedit 를 사용했어요. msconfig는 제대로 되는지 확인 못함...

c:\> bcdedit /debug on

[COM1 사용시]
c:\> bcdedit /dbgsettings serial debugport:1 baudrate:115200

[1394 사용시]
c:\> bcdedit /dbgsettings 1394 channel:11



이것으로 Debuggee 설정이 끝났습니다. 다음은 Debugger 설정입니다.

WinDBG 설치된 컴퓨터에서 시작->실행에 다음과 같이 입력합니다.

windbg -b -k com:pipe,port=\\.\pipe\com_1,resets=0

매번 입력하기 힘드니까 [바로가기]를 만들어두면 편합니다.

Vista 이상에선 관리자 모드로 실행해야합니다.



출처: http://phidel.tistory.com/48 [Study Log of phiDel]



'gravity-free > windbg' 카테고리의 다른 글

windbg 01  (0) 2015.12.10
:

security research blog

gravity-free 2017. 6. 29. 09:37

'gravity-free' 카테고리의 다른 글

IDA Ylight.py  (0) 2019.04.21
:

비트코인 블록 탐색 서비스

etc 2017. 6. 28. 10:56

'etc' 카테고리의 다른 글

Windows10 잠금화면  (0) 2017.02.22
세미나실 및 파티룸 대여  (0) 2016.08.30
sublime 한글  (0) 2015.10.21
:

동적 분석 서비스

Analysis 2017. 6. 28. 10:37
:

REST API in php

programming/php 2017. 6. 27. 18:12

https://www.leaseweb.com/labs/2015/10/creating-a-simple-rest-api-in-php/


http://www.tutorialsface.com/2016/02/simple-php-mysql-rest-api-sample-example-tutorial/



'programming > php' 카테고리의 다른 글

Creating a simple REST API in PHP  (0) 2017.06.27
:

git 관련 자료 모음

programming 2017. 6. 27. 16:44

버전관리를 들어본적 없는 사람들을 위한 DVCS - Git

https://www.slideshare.net/ibare/dvcs-git


svn 능력자를 위한 git 개념 가이드

https://www.slideshare.net/einsub/svn-git-17386752

'programming' 카테고리의 다른 글

bitbucket & github 비교 1  (0) 2017.06.26
online code compiler 2  (0) 2016.12.15
online code compiler  (0) 2016.09.27
알고리즘  (0) 2016.01.22
알고리즘  (0) 2015.12.01
:

Creating a simple REST API in PHP

programming/php 2017. 6. 27. 16:03

Creating a simple REST API in PHP

I’m the author of php-crud-api and I want to share the core of the application with you. It includes routing a JSON REST request, converting it into SQL, executing it and giving a meaningful response. I tried to write the application as short as possible and came up with these 65 lines of code:

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
<?php
 
// get the HTTP method, path and body of the request
$method = $_SERVER['REQUEST_METHOD'];
$request = explode('/', trim($_SERVER['PATH_INFO'],'/'));
$input = json_decode(file_get_contents('php://input'),true);
 
// connect to the mysql database
$link = mysqli_connect('localhost', 'user', 'pass', 'dbname');
mysqli_set_charset($link,'utf8');
 
// retrieve the table and key from the path
$table = preg_replace('/[^a-z0-9_]+/i','',array_shift($request));
$key = array_shift($request)+0;
 
// escape the columns and values from the input object
$columns = preg_replace('/[^a-z0-9_]+/i','',array_keys($input));
$values = array_map(function ($value) use ($link) {
  if ($value===null) return null;
  return mysqli_real_escape_string($link,(string)$value);
},array_values($input));
 
// build the SET part of the SQL command
$set = '';
for ($i=0;$i<count($columns);$i++) {
  $set.=($i>0?',':'').'`'.$columns[$i].'`=';
  $set.=($values[$i]===null?'NULL':'"'.$values[$i].'"');
}
 
// create SQL based on HTTP method
switch ($method) {
  case 'GET':
    $sql = "select * from `$table`".($key?" WHERE id=$key":''); break;
  case 'PUT':
    $sql = "update `$table` set $set where id=$key"; break;
  case 'POST':
    $sql = "insert into `$table` set $set"; break;
  case 'DELETE':
    $sql = "delete `$table` where id=$key"; break;
}
 
// excecute SQL statement
$result = mysqli_query($link,$sql);
 
// die if SQL statement failed
if (!$result) {
  http_response_code(404);
  die(mysqli_error());
}
 
// print results, insert id or affected row count
if ($method == 'GET') {
  if (!$key) echo '[';
  for ($i=0;$i<mysqli_num_rows($result);$i++) {
    echo ($i>0?',':'').json_encode(mysqli_fetch_object($result));
  }
  if (!$key) echo ']';
} elseif ($method == 'POST') {
  echo mysqli_insert_id($link);
} else {
  echo mysqli_affected_rows($link);
}
 
// close mysql connection
mysqli_close($link);

This code is written to show you how simple it is to make a fully operational REST API in PHP.

Running

Save this file as “api.php” in your (Apache) document root and call it using:

http://localhost/api.php/{$table}/{$id}

Or you can use the PHP built-in webserver from the command line using:

$ php -S localhost:8888 api.php

The URL when ran in from the command line is:

http://localhost:8888/api.php/{$table}/{$id}

NB: Don’t forget to adjust the ‘mysqli_connect’ parameters in the above script!

REST API in a single PHP file

Although the above code is not perfect it actually does do 3 important things:

  1. Support HTTP verbs GET, POST, UPDATE and DELETE
  2. Escape all data properly to avoid SQL injection
  3. Handle null values correctly

One could thus say that the REST API is fully functional. You may run into missing features of the code, such as:

  1. No related data (automatic joins) supported
  2. No condensed JSON output supported
  3. No support for PostgreSQL or SQL Server
  4. No POST parameter support
  5. No JSONP/CORS cross domain support
  6. No base64 binary column support
  7. No permission system
  8. No search/filter support
  9. No pagination or sorting supported
  10. No column selection supported

Don’t worry, all these features are available in php-crud-api, which you can get from Github. On the other hand, now that you have the essence of the application, you may also write your own!

출처 : https://www.leaseweb.com/labs/2015/10/creating-a-simple-rest-api-in-php/


'programming > php' 카테고리의 다른 글

REST API in php  (0) 2017.06.27
:

bitbucket & github 비교 1

programming 2017. 6. 26. 11:40

무료 이용의 경우

GithubBitbucket
사용자무제한5명
공개저장소무제한무제한
개인저장소미제공무제한

제일 싼 요금제의 경우

GithubBitbucket
사용자무제한10명
공개저장소무제한무제한
개인저장소무제한무제한

Bitbucket

개인저장소 제공이 무제한이라, 개인 용도로 쓰긴 적합하지만, 사용자수 제한이 걸려있어서 오픈소스 운영할 순 없음

개인적으로 쓰기에 적합

Github

오픈소스, 공개 이거 두 개엔 최적화되어 있음

오픈소스로 쓰기에 적합


출처 : http://hyeonjae-blog.logdown.com/posts/544463-github-bitbucket

'programming' 카테고리의 다른 글

git 관련 자료 모음  (0) 2017.06.27
online code compiler 2  (0) 2016.12.15
online code compiler  (0) 2016.09.27
알고리즘  (0) 2016.01.22
알고리즘  (0) 2015.12.01
:

instant debugger

Reversing 2017. 5. 2. 10:56

'Reversing' 카테고리의 다른 글

hooks  (0) 2015.11.12
Anti-reversing  (0) 2012.09.24
프로세스 시작시 자동 디버깅  (0) 2012.01.05
Restructuring01  (0) 2011.12.12
unpack 참고 url  (0) 2011.11.08
: