net.ibao.dnscat.util
Class SixBitDNSEncoder
java.lang.Objectnet.ibao.dnscat.util.SixBitDNSEncoder
public class SixBitDNSEncoder
extends java.lang.Object
This class implements encoding of data into DNS names. The name uses 6 bit charset (as defined below) and longer names are
separated by dots (every NAMELEN characters). The class also adds encoded the frame length (the first charater).
Version:
- Tadeusz Pietraszek (tadek@pietraszek.org).
private int | NAMELEN- DNS charset
|
private byte[] | forwardMap- maximum name length (after how many characters to insert dots)
|
private static Logger | logger
|
private static String | map
|
private byte[] | reverseMap
|
byte[] | decode(String si)- Decodes a DNS name into a binary byter
|
String | encode(byte[] bi)
|
String | encode(byte[] bi, int biLength)- Encodes a binary buffer into a DNS name.
|
NAMELEN
private final int NAMELEN
DNS charset
forwardMap
private byte[] forwardMap
maximum name length (after how many characters to insert dots)
logger
private static Logger logger
map
private static final String map
reverseMap
private byte[] reverseMap
SixBitDNSEncoder
public SixBitDNSEncoder()
Construct the new DNS encoder/decoder class.
decode
public byte[] decode(String si)
throws Exception Decodes a DNS name into a binary byter
si - Encoded DNS name
- Binary buffer
encode
public String encode(byte[] bi)
throws Exception
encode
public String encode(byte[] bi,
int biLength)
throws Exception Encodes a binary buffer into a DNS name.
bi - byte Data bufferbiLength - Buffer length. Due to encoding used it has to be <254 (DNS can't handle more anyway)
- Encoded DNS name