working commit
parent
705c775c27
commit
5392059465
Binary file not shown.
|
@ -61,3 +61,5 @@
|
|||
7369 7621 1698284653283151767 insane_dns ff5ae500893d0be1
|
||||
2 2997 1698338548693635693 CMakeFiles/insane_dns.dir/src/main.cpp.o 727da43cdbc82421
|
||||
2997 3087 1698338548789636298 insane_dns ff5ae500893d0be1
|
||||
5 7590 1698350638277966894 CMakeFiles/insane_dns.dir/src/main.cpp.o 727da43cdbc82421
|
||||
7590 7806 1698350638505965615 insane_dns ff5ae500893d0be1
|
||||
|
|
Binary file not shown.
|
@ -1,3 +1,3 @@
|
|||
Start testing: Oct 26 12:42 EDT
|
||||
Start testing: Oct 26 16:04 EDT
|
||||
----------------------------------------------------------
|
||||
End testing: Oct 26 12:42 EDT
|
||||
End testing: Oct 26 16:04 EDT
|
||||
|
|
Binary file not shown.
24
src/main.cpp
24
src/main.cpp
|
@ -46,7 +46,6 @@ static inline constexpr IPAddress REPLACEMENT_IP()
|
|||
*/
|
||||
static const std::unordered_set<std::string> DISALLOWED_DOMAINS{
|
||||
"en.wikipedia.org",
|
||||
"tpgc.me",
|
||||
"zombo.com"
|
||||
};
|
||||
|
||||
|
@ -107,7 +106,7 @@ class question
|
|||
uint16_t QTYPE;
|
||||
uint16_t QCLASS;
|
||||
public:
|
||||
explicit question(const byte_reader& reader)
|
||||
explicit question(const blt::byte_reader& reader)
|
||||
{
|
||||
// process the full question
|
||||
while (true)
|
||||
|
@ -144,7 +143,7 @@ class answer
|
|||
bool requires_reset = false;
|
||||
unsigned char* RDATA = nullptr;
|
||||
public:
|
||||
explicit answer(const byte_reader& reader)
|
||||
explicit answer(const blt::byte_reader& reader)
|
||||
{
|
||||
reader.to(NAME);
|
||||
reader.to(TYPE);
|
||||
|
@ -186,6 +185,10 @@ class answer
|
|||
|
||||
inline void reset(size_t offset) const
|
||||
{
|
||||
if (!requires_reset)
|
||||
return;
|
||||
// like I said not 100 on how to construct the ptr
|
||||
// seems to be causing issues. I've stopped working on this as it's not required.
|
||||
auto i16 = static_cast<uint16_t>(offset) & (~(0b11 << 14));
|
||||
NAME |= i16;
|
||||
}
|
||||
|
@ -195,7 +198,7 @@ class answer
|
|||
|
||||
answer& operator=(const answer& answer) = delete;
|
||||
|
||||
answer(answer&& move)
|
||||
answer(answer&& move) noexcept
|
||||
{
|
||||
NAME = move.NAME;
|
||||
TYPE = move.TYPE;
|
||||
|
@ -206,7 +209,7 @@ class answer
|
|||
move.RDATA = nullptr;
|
||||
}
|
||||
|
||||
answer& operator=(answer&& move)
|
||||
answer& operator=(answer&& move) noexcept
|
||||
{
|
||||
NAME = 0;
|
||||
NAME = move.NAME;
|
||||
|
@ -246,9 +249,6 @@ class send_buffer
|
|||
{
|
||||
blt::mem::toBytes(t, &internal_data[write_index]);
|
||||
write_index += sizeof(T);
|
||||
} else if constexpr (std::is_same_v<T, std::string>)
|
||||
{
|
||||
static_assert("No");
|
||||
} else if constexpr (std::is_same_v<T, answer>)
|
||||
{
|
||||
write(t.NAME);
|
||||
|
@ -351,18 +351,18 @@ int main()
|
|||
uint16_t num_of_answers;
|
||||
blt::mem::fromBytes(&mod_recv_buf[6], num_of_answers);
|
||||
|
||||
byte_reader reader2(mod_recv_buf.data(), mod_recv_buf.size());
|
||||
blt::byte_reader reader(mod_recv_buf.data(), mod_recv_buf.size());
|
||||
|
||||
BLT_INFO("Bytes answered %d with %d answers", out_bytes, num_of_answers);
|
||||
|
||||
// no one actually does multiple questions. trying to do it in dig is not easy
|
||||
// and the standard isn't really designed for this (how do we handle if one question errors but the other doesn't? there is only
|
||||
// one return code.)
|
||||
question q(reader2);
|
||||
question q(reader);
|
||||
std::vector<answer> answers;
|
||||
for (int i = 0; i < num_of_answers; i++)
|
||||
{
|
||||
answer a(reader2);
|
||||
answer a(reader);
|
||||
answers.push_back(std::move(a));
|
||||
}
|
||||
|
||||
|
@ -387,7 +387,7 @@ int main()
|
|||
a.reset(question_offset);
|
||||
send.write(a);
|
||||
}
|
||||
send.write(reader2.from(), out_bytes - reader2.last());
|
||||
send.write(reader.from(), out_bytes - reader.last());
|
||||
|
||||
asio::error_code ignored_error;
|
||||
socket.send_to(send.buffer(), remote_endpoint, 0, ignored_error);
|
||||
|
|
Loading…
Reference in New Issue