-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 5ffeca9
Showing
22 changed files
with
2,567 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
@ECHO OFF | ||
SetLocal EnableDelayedExpansion | ||
|
||
:: Collect every source file | ||
set Source= | ||
for /R %%f in (*.cpp) do call set Source=%%Source%% %%f | ||
|
||
:: Make 'Binary' folder if it does not exist | ||
if not exist Binary mkdir Binary | ||
|
||
:: Compile the files | ||
clang++ %Source% -o Binary/ip-calculator.exe -ISource | ||
|
||
:: If there are errors then print it to the screen and exit the program | ||
if %ERRORLEVEL% NEQ 0 (echo Error:%ERRORLEVEL% && exit) | ||
|
||
:: Print a success text | ||
echo Binary files successfully created! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#! /bin/bash | ||
|
||
# Collect every source file | ||
Source=$(find ./Source -name *.cpp) | ||
if [[ $1 == "-v" || $1 == "--verbose" ]]; then | ||
echo -e "[ \033[1;34mi\033[0m ] Every \"*.cpp\" file collected from \"Source\" folder." | ||
fi | ||
|
||
# Make 'Binary' folder if it does not exist | ||
if [[ $1 == "-v" || $1 == "--verbose" ]]; then | ||
if [ -d "./Binary/" ]; then | ||
echo -e "[ \033[1;34mi\033[0m ] Binary folder already exists." | ||
else | ||
echo -e "[ \033[1;34mi\033[0m ] Binary folder has been created" | ||
fi | ||
fi | ||
mkdir -p Binary | ||
|
||
# Compile the files | ||
if [[ $1 == "-v" || $1 == "--verbose" ]]; then | ||
echo -e "[ \033[1;34mi\033[0m ] Staring the building process." | ||
clang++ $Source -g -o Binary/ip-calculator -ISource | ||
else | ||
clang++ $Source -o Binary/ip-calculator -ISource | ||
fi | ||
|
||
# If there are errors then print it to the screen and exit the program | ||
Error=$? | ||
if [ $Error -ne 0 ]; then | ||
echo -e "[ \033[1;31mx\033[0m ] Failed to build the project. Errorcode: "$Error && exit | ||
fi | ||
|
||
# Print a success text | ||
echo -e "[ \033[1;32m+\033[0m ] Binary files successfully created!" |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
.TH IP-Calculator 1 | ||
.SH NAME | ||
IP-Calculator \- Calculates subnets and prints information about an IP address. | ||
.SH SYNOPSIS | ||
.B ip-calculator | ||
[\fI\,OPTION\/\fR] <\fI\,IP ADDRESS\/\fR> [\fI\,NETMASK\/\fR] | ||
.SH DESCRIPTION | ||
The IP Calculator offers a comprehensive solution for subnetting and obtaining information about IP addresses. With its capability to divide a large network into smaller subnets, it makes managing and organizing your network simple. The calculator also has a feature that can quickly identify whether an IP address is classful or classless, providing a clear picture of your network's structure. In addition to calculating the number of subnets and host addresses per subnet, it can also create custom subnet masks. The Command Line Interface (CLI) enables easy input of IP addresses and provides concise and easily understandable outputs. | ||
.SH OPTIONS | ||
.TP | ||
\fB\-s\fR <\fIamount of required subnets\fR>, \fB\-\-subnets\fR <\fIamount of required subnets\fR> | ||
Devide the network into equal size subnetworks. | ||
.TP | ||
\fB\-e\fR <\fIamount of required hosts\fR>, \fB\-\-hosts\fR <\fIamount of required hosts\fR> | ||
Devide the network into equal size subnetworks considering the required hosts. | ||
.TP | ||
\fB\-d\fR <\fIamount of required subnets\fR>..., \fB\-\-deviding\fR <\fIamount of required subnets\fR>... | ||
Devide the network into subnetworks, then do it and stop when it runs out of requests. | ||
.TP | ||
\fB\-c\fR <\fIrequired hosts in cronological order\fR>..., \fB\-\-cronology\fR <\fIrequired hosts in cronological order\fR>... | ||
Devides the network into subnetwork considering the required hosts and the order or requests. | ||
.TP | ||
\fB\-h\fR, \fB\-\-help\fR | ||
Display the help page | ||
.TP | ||
\fB\-v\fR, \fB\-\-version\fR | ||
Display the version | ||
.SH EXAMPLES | ||
.B ip-calculator | ||
169.254.0.0 | ||
.br | ||
.B ip-calculator | ||
192.168.1.0 | ||
255.255.255.0 | ||
.br | ||
.B ip-calculator | ||
\fI\-s\fR | ||
3 | ||
192.168.1.0 | ||
255.255.255.0 | ||
.br | ||
.B ip-calculator | ||
\fI\-e\fR | ||
62 | ||
172.30.0.0 | ||
255.255.0.0 | ||
.br | ||
.B ip-calculator | ||
\fI\-d\fR | ||
4[2] 2 3[1] 4 | ||
10.0.0.0 | ||
255.0.0.0 | ||
.br | ||
.B ip-calculator | ||
\fI\-c\fR | ||
100 2000 50 30 200 | ||
92.128.0.0 | ||
255.128.0.0 | ||
.br | ||
.B ip-calculator | ||
\fI\-h\fR | ||
.br | ||
.B ip-calculator | ||
\fI\-v\fR | ||
.SH REPORTING BUGS | ||
You can report bugs on the project's github page. | ||
.br | ||
<https://github.com/GamerFandor/IP-Calculator/issues> | ||
.SH LICENCE | ||
IP-Calculator Copyright (C) 2022 Andor Zoltán Fülöp | ||
.br | ||
This program comes with ABSOLUTELY NO WARRANTY; for details visit <https://gnu.org/licenses/gpl.html>. | ||
.br | ||
This is free software, and you are welcome to redistribute it | ||
.br | ||
under certain conditions; visit <https://gnu.org/licenses/gpl.html> for details. | ||
.SH AUTHOR | ||
Written by Andor Zoltán Fülöp. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
#! /bin/bash | ||
|
||
######################## Informations about the pakcage and the app ######################### | ||
|
||
AppName="IP-Calculator" | ||
AppVersion="1.0.0" | ||
PackageVersion="1" | ||
Architecture="amd64" | ||
Maintainer="Andor Zoltán Fülöp <https://github.com/GamerFandor/>" | ||
Description="Calculates subnets and prints information about an IP address." | ||
|
||
AppBinaryPath="./Binary/ip-calculator" | ||
ManpagePath="./Miscellaneous/Manpage.1" | ||
PackageOutputPath="./Binary/" | ||
|
||
############################################################################################# | ||
|
||
# Collect every source file | ||
Source=$(find ./Source -name *.cpp) | ||
|
||
# Make 'Binary' folder if it does not exist | ||
mkdir -p Binary | ||
|
||
# Compile the files | ||
clang++ $Source -o ./Binary/ip-calculator -ISource | ||
|
||
# If there are errors then print it to the screen and exit the program | ||
Error=$? | ||
if [ $Error -ne 0 ]; then | ||
echo -e "[ \033[1;31mx\033[0m ] Failed to build the project. Errorcode: "$Error && exit | ||
fi | ||
|
||
# Print a success text | ||
echo -e "[ \033[1;32m+\033[0m ] Binary files successfully created!" | ||
|
||
# Generate the full file name | ||
FullPackageName=$AppName"_"$AppVersion"-"$PackageVersion"_"$Architecture | ||
|
||
# Place the executable inside the package folder | ||
mkdir -p ./$FullPackageName/usr/local/bin | ||
cp $AppBinaryPath ./$FullPackageName/usr/local/bin | ||
|
||
# Place the manpage inside the package folder | ||
mkdir -p ./$FullPackageName/usr/share/man/man1 | ||
cp $ManpagePath ./$FullPackageName/usr/share/man/man1/$AppName.1 | ||
|
||
# Compress manpage | ||
gzip ./$FullPackageName/usr/share/man/man1/$AppName.1 ./$FullPackageName/usr/share/man/man1/$AppName.1.gz | ||
|
||
# Create control file | ||
mkdir ./$FullPackageName/DEBIAN | ||
cat << EOF > ./$FullPackageName/DEBIAN/control | ||
Package: $AppName | ||
Version: $AppVersion | ||
Architecture: $Architecture | ||
Maintainer: $Maintainer | ||
Description: $Description | ||
EOF | ||
|
||
# Make the package | ||
dpkg-deb --build --root-owner-group $FullPackageName | ||
mv $FullPackageName.deb $PackageOutputPath | ||
|
||
# Clean up | ||
rm -r $FullPackageName |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# IP Calculator # | ||
|
||
The IP Calculator offers a comprehensive solution for subnetting and obtaining information about IP addresses. With its capability to divide a large network into smaller subnets, it makes managing and organizing your network simple. The calculator also has a feature that can quickly identify whether an IP address is classful or classless, providing a clear picture of your network's structure. In addition to calculating the number of subnets and host addresses per subnet, it can also create custom subnet masks. The Command Line Interface (CLI) enables easy input of IP addresses and provides concise and easily understandable outputs. | ||
|
||
If you have any feedback or suggestions, please let me know by opening an [issue](https://github.com/GamerFandor/IP-Calculator/issues) on GitHub. | ||
|
||
# How to use # | ||
|
||
You can use the `-h` or `--help` arguments or the `man` command if you installed the .deb package for printing the manual. | ||
```ip-calculator -h``` | ||
```ip-calculator --help``` | ||
```man ip-calculator``` | ||
|
||
# Installation # | ||
|
||
#### Install the .deb package #### | ||
|
||
``` | ||
# Download the package | ||
wget https://github.com/GamerFandor/IP-Calculator/releases/download/v1.0.0/IP-Calculator_1.0.0-1_amd64.deb | ||
# Install the .deb package | ||
sudo dpkg -i IP-Calculator_1.0.0-1_amd64.deb | ||
# Remove the .deb file | ||
rm IP-Calculator_1.0.0-1_amd64.deb | ||
# Check whether the installation was successful | ||
ip-calculator | ||
``` | ||
|
||
#### Download and use on Linux #### | ||
|
||
``` | ||
# Download the compiled program | ||
wget https://github.com/GamerFandor/IP-Calculator/releases/download/v1.0.0/ip-calculator | ||
# Check whether the program downloaded successfully | ||
ip-calculator | ||
``` | ||
|
||
#### Build yourself on Linux #### | ||
|
||
``` | ||
# Install clang | ||
sudo apt-get update && sudo apt-get install clang -y | ||
# Download the Source files | ||
wget https://github.com/GamerFandor/IP-Calculator/archive/refs/tags/v1.0.0.tar.gz | ||
# Extract the .tar.gz file | ||
tar -xf v1.0.0.tar.gz | ||
# Enter the directory | ||
cd IP-Calculator-1.0.0 | ||
# Run the build script | ||
./Build.sh -v | ||
# Check whether the program compiled successfully | ||
./Binary/ip-calculator | ||
``` | ||
|
||
#### Build yourself on Windows #### | ||
|
||
1. Download clang from [here](https://prereleases.llvm.org/win-snapshots/LLVM-12.0.0-6923b0a7-win64.exe) and install it | ||
2. Download the Source files from [here](https://github.com/GamerFandor/IP-Calculator/archive/refs/tags/v1.0.0.zip) | ||
3. UnZip the downloaded file | ||
4. Open a Command Prompt | ||
5. Navigate to the UnZiped directory | ||
6. Run the build script: | ||
```.\Build.bat``` | ||
7. Check whether the program compiled successfully | ||
```.\Binary\ip-calculator.exe``` |
Oops, something went wrong.