Skip to content
 
 

Latest commit

 

History

16 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Local Dns Server

Local DNS Server to bring more control over the OS

Description

This program allow the user to redirect the requests through this software to :

  • Monitor the DNS requests (spot spywares, weird domains, etc)
  • Filter the DNS requests

Indeed, if a software can't obtain the IP of it's server, so it will not be able to send any request. But most of viruses use direct IP, no DNS requests, so this software will not protect from most of viruses but it will bring a better control over not trusted softwares like Google Chrome which can send private information to a server (this way you can spot this activity and block it).

While the program is running, it will use the "filters.txt" file to know which domain to filter and which one to allow. It shows too (in diagnosis mode [default mode]) the domains requested by your computer, allowing you to see clearly the domains reached.

Compatibilities

Windows 10 Windows 8.1 Windows 7
Windows Vista Windows XP Ubuntu

Run

Windows

$ localdnsserver.exe [OPTIONS]

Linux

$ ./localdnsserver [OPTIONS]

Options

Command(s) Parameter(s) Description Compatibility
-h, -help, --help Display the help about the options
-p, -port [PORT] Define the port
-rip, -remoteip [IP] Define the IP of the remote DNS Server
-rp, -remoteport [PORT] Define the port of the remote DNS Server
-dns [FILE_PATH] Define the file containing the filters
-o, -output [FILE_PATH] Define the output file
-c, -cache Use a DNS Cache
-hide Hide the window Windows only

Installation

Makefile

Command Description
$ make Equivalent to make release
$ make release Create a release version of the software
$ make debug Create a debug version of the software
$ make clear
$ make clean
Clean the folders
$ make help Get help about the makefile

Windows

Description

On Windows, there is no DNS Server already installed and running, making the installation something easy. The DNS cache is managed by the operating system (made by "dnsmasq" in some distro of Linux).

The installation consists to change the DNS server which will be used by your operating system to send DNS requests. This software is a DNS server hosted in local ; so you will have to change the IP of the DNS server to use into "127.0.0.1".

To do so, in Windows, you can follow this tutorial : http://mintywhite.com/windows-7/change-dns-server-windows-7/ . In the "Use the following DNS server addresses" at step 5, your will put on the first line : "127.0.0.1" and on the second line nothing or an IP that you may be using if you encounter a problem with the software (in France I use "212.27.40.241").

Get the software

You can download the source code and compile it or download a compiled version from this repo.

If you download the GitHub repository, you will have to compile it.

To do so, you just have to run configure.exe, which will create the makefile for Windows. After that, you will have to use a command make (for example the one included in MinGW or Cygwin).

$ configure.exe
$ make

It will result in the creation of the final file localdnsserver.exe.

Autorun

Open the folder "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp" and create a new CMD file (for example : "startlocaldnsserver.cmd").

Put in the file the following code (with [SOFT_PATH] the path of the folder containing the software and [OPTIONS] the list of options you want to use) :

@echo off

:: Clear the DNS Cache
ipconfig /flushdns

:: Go where the software is
cd [SOFT_PATH]

:: Start the software
start /b localdnsserver.exe [OPTIONS]

cls
Note no.1

If [SOFT_PATH] is not on the same drive of your operating system, you will have to specify it in the CMD file.

For example, if the software path is : "D:\Projects\cpp\LocalDnsServer\dist\Debug\MinGW-Windows" and my operating system is on the drive "C:", you will have to do so :

@echo off

:: Clear the DNS Cache
ipconfig /flushdns

:: Go where the software is
D:
cd D:\Projects\cpp\LocalDnsServer\dist\Debug\MinGW-Windows

:: Start the software
start /b localdnsserver.exe [OPTIONS]

cls
Note no.2

Don't forget that if you want to start it without window (hidden), you will have to add the option "-hide" in [OPTIONS].

Linux

Description

Tested with Ubuntu

When you will try to bind a socket to the port 53 (DNS Server port), you will have an error. It is explained by the presence of the software dnsmasq running in background and allowing the computer to have a DNS cache. Indeed, this software is binding a socket on the port 53. That's why we will have to stop dnsmasq and restart it but on another port. Then we will chain it to our software.

Get the software

Here you have two choices :

  • Compile the software for your machine
  • Use an already compiled version
Compilation

If you don't have git installed on your computer, you need to download and install it.

First of all, you have to download the Repository :

$ git clone https://github.com/OpenMarshal/LocalDnsServerCpp.git

Now, you have to compile the code for your processor, using your own compiler.

To do so, you just have to run configure and to use the command make.

$ sudo chmod +x configure
$ ./configure
$ make
Download already compiled

...

Installation

$ sudo pkill dns

http://linux.die.net/man/8/dnsmasq

$ sudo dnsmasq -p [PORT]
$ sudo dnsmasq -p 35353
$ sudo nano /etc/resolv.conf

add

nameserver 127.0.0.1

put in comment others :

# nameserver 212.27.40.240

Result :

# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN

# nameserver 212.27.40.240
# nameserver 212.27.40.241

nameserver 127.0.0.1
sudo pkill dnsmasq

Get the list of process using the port 53 :

sudo netstat -lanp | grep ":53 "

Run it after compilation :

sudo ./localdnsserver

Restart the cache "dnsmasq" after having stopped localdnsserver :

sudo dnsmasq

Autorun

Create the file which will be used to run the program with your own options.

$ sudo nano /etc/init.d/autorunLocalDnsServer

Put the content

#!/bin/bash

# Go to the program location
cd /MY/PATH/

# Run the program (& = in parallel)
sudo ./localdnsserver [OPTIONS] &

Then you just have to update the list of files to start :

$ sudo chmod +x /etc/init.d/filename
$ sudo update-rc.d autorunLocalDnsServer defaults

About

DNS Server (C++)

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages