<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Giannis Ftaras</title>
    <description>The latest articles on DEV Community by Giannis Ftaras (@giannisftaras).</description>
    <link>https://dev.to/giannisftaras</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F767728%2F77957aca-f542-4de7-80eb-76467a25d412.jpg</url>
      <title>DEV Community: Giannis Ftaras</title>
      <link>https://dev.to/giannisftaras</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/giannisftaras"/>
    <language>en</language>
    <item>
      <title>Managing multiple databases with Docker and phpMyAdmin</title>
      <dc:creator>Giannis Ftaras</dc:creator>
      <pubDate>Mon, 06 Nov 2023 10:08:50 +0000</pubDate>
      <link>https://dev.to/giannisftaras/managing-multiple-databases-with-docker-and-phpmyadmin-11o8</link>
      <guid>https://dev.to/giannisftaras/managing-multiple-databases-with-docker-and-phpmyadmin-11o8</guid>
      <description>&lt;p&gt;When you are working locally with multiple projects you sometimes need to access different databases in order to view, change or manipulate data.&lt;/p&gt;

&lt;p&gt;There are multiple ways to achieve this...&lt;/p&gt;

&lt;h3&gt;
  
  
  The old fashioned way
&lt;/h3&gt;

&lt;p&gt;Using the good-old MySQL CLI in order to jump in and do what you want. This has the benefit of making you more conformable in using the terminal which might be required for staging or production environments, but this can also slow down your process and can be quite daunting at times.&lt;/p&gt;

&lt;h3&gt;
  
  
  We have an app for that!
&lt;/h3&gt;

&lt;p&gt;There are multiple applications out there that can help you manage databases such as &lt;a href="https://www.mysql.com/products/workbench/"&gt;MySQL Workbench&lt;/a&gt;, &lt;a href="https://tableplus.com/"&gt;TablePlus&lt;/a&gt; or &lt;a href="https://www.beekeeperstudio.io/"&gt;Beekeeper Studio&lt;/a&gt;. While all these applications are awesome and are doing a great job at what they are designed for, they also have their drawbacks. MySQL Workbench can be hard to work with sometimes, TablePlus is not free and while Beekeeper has a free Community version it cannot be used in an enterprise environment or the free features might seem quite limiting at times.&lt;/p&gt;

&lt;h3&gt;
  
  
  phpMyAdmin to the rescue!
&lt;/h3&gt;

&lt;p&gt;A web-based GUI that allows you to easily view and manage the databases that you want. Don't get me wrong, phpMyAdmin has its drawbacks as well, such as - prone to crashing, many vulnerabilities are often found, etc. but for local development I believe it has the right ratio of pros vs cons in order to be my daily DB management tool.&lt;/p&gt;




&lt;h2&gt;
  
  
  Setting up phpMyAdmin with Docker
&lt;/h2&gt;

&lt;p&gt;If you're using Docker, the installation process of phpMyAdmin is quite easy and straight-forward. You'll only need a couple of things:&lt;/p&gt;

&lt;h4&gt;
  
  
  Install Docker
&lt;/h4&gt;

&lt;p&gt;No matter which operating system you use, you will have to install &lt;a href="https://www.docker.com/products/docker-desktop/"&gt;Docker&lt;/a&gt; &lt;small&gt;&lt;em&gt;(duh!)&lt;/em&gt;&lt;/small&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Create the docker-compose file
&lt;/h4&gt;

&lt;p&gt;Select a folder in your computer where you want to run this project from and create a &lt;code&gt;docker-compose.yml&lt;/code&gt; file.&lt;br&gt;
This file will contain all the necessary information that Docker needs in order to build the appropriate containers. A default database will also be created in order to be used as a workbench and to avoid slow loading times if your other databases are not currently online or spun up.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;version&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;3.8'&lt;/span&gt;

&lt;span class="na"&gt;services&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;

  &lt;span class="na"&gt;workbench-mysql-database&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;mysql:8.0.0'&lt;/span&gt;
    &lt;span class="na"&gt;container_name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;workbench-mysql-database'&lt;/span&gt;
    &lt;span class="na"&gt;environment&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;MYSQL_ROOT_PASSWORD&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;root'&lt;/span&gt;
      &lt;span class="na"&gt;MYSQL_DATABASE&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;workbench'&lt;/span&gt;
      &lt;span class="na"&gt;MYSQL_USER&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;workbench'&lt;/span&gt;
      &lt;span class="na"&gt;MYSQL_PASSWORD&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;workbench-pass'&lt;/span&gt;
      &lt;span class="na"&gt;MYSQL_ALLOW_EMPTY_PASSWORD&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;
    &lt;span class="na"&gt;ports&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;${FORWARD_DB_PORT:-3310}:3306'&lt;/span&gt;
    &lt;span class="na"&gt;networks&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;internal-net&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;volumes&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;mysql-data:/var/lib/mysql&lt;/span&gt;
    &lt;span class="na"&gt;restart&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;unless-stopped&lt;/span&gt;

  &lt;span class="na"&gt;workbench-phpmyadmin&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;phpmyadmin:latest'&lt;/span&gt;
    &lt;span class="na"&gt;container_name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;workbench-phpmyadmin'&lt;/span&gt;
    &lt;span class="na"&gt;environment&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;UPLOAD_LIMIT&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;600M'&lt;/span&gt;
    &lt;span class="na"&gt;ports&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;7090:80'&lt;/span&gt;
    &lt;span class="na"&gt;volumes&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;./config.user.inc.php:/etc/phpmyadmin/config.user.inc.php&lt;/span&gt;
    &lt;span class="na"&gt;networks&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;internal-net&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;restart&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;unless-stopped&lt;/span&gt;

&lt;span class="na"&gt;volumes&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;mysql-data&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
&lt;span class="na"&gt;networks&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;internal-net&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As you can see in the code above a file named &lt;code&gt;config.user.inc.php&lt;/code&gt; will also be mounted to the phpMyAdmin container. This file holds all the configuration needed in order to connect to our databases.&lt;/p&gt;

&lt;h4&gt;
  
  
  Create the phpMyAdmin configuration file
&lt;/h4&gt;

&lt;p&gt;In the same folder that you created &lt;code&gt;docker-compose.yml&lt;/code&gt; you also need to create the &lt;code&gt;config.user.inc.php&lt;/code&gt; file.&lt;br&gt;
In the configuration below we are specifying the attributes needed to connect to our other databases.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nv"&gt;$cfg&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'Servers'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="s1"&gt;'auth_type'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'config'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s1"&gt;'host'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'host.docker.internal'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s1"&gt;'port'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;3306&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s1"&gt;'user'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'db1user'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s1"&gt;'password'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'db1pass'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s1"&gt;'verbose'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'BD1'&lt;/span&gt;
    &lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="s1"&gt;'auth_type'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'config'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s1"&gt;'host'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'host.docker.internal'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s1"&gt;'port'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;3307&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s1"&gt;'user'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'db2user'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s1"&gt;'password'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'db2pass'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s1"&gt;'verbose'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'DB2'&lt;/span&gt;
    &lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="mi"&gt;3&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="s1"&gt;'auth_type'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'config'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s1"&gt;'host'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'workbench-mysql-database'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s1"&gt;'port'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;3306&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s1"&gt;'user'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'root'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s1"&gt;'password'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'root'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s1"&gt;'verbose'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'Workbench'&lt;/span&gt;
    &lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;];&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For the &lt;code&gt;host&lt;/code&gt; attribute there are three options that you can use:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;If the database is in the same container you can use the instance name (e.g. workbench-mysql-database)&lt;/li&gt;
&lt;li&gt;If the database is in the same machine but on a different Docker container, you can use the Docker host domain (host.docker.internal)&lt;/li&gt;
&lt;li&gt;You can also use an internal or external IP (e.g. 192.168.1.205 or 10.15.203.5)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In this file you can also add extra &lt;a href="https://docs.phpmyadmin.net/en/latest/config.html"&gt;phpMyAdmin configuration attributes&lt;/a&gt; such the default server to be loaded on boot and many other. The configuration can also be changed on the fly without having to restart the containers.&lt;/p&gt;

&lt;p&gt;This guide assumes that on each project that you are working on you have a different external port assigned to your MySQL instances otherwise when you try to spin up two containers at once you'll get an IP conflict.&lt;/p&gt;

</description>
      <category>docker</category>
      <category>phpmyadmin</category>
      <category>tutorial</category>
      <category>programming</category>
    </item>
    <item>
      <title>Recursive wget and file transfer</title>
      <dc:creator>Giannis Ftaras</dc:creator>
      <pubDate>Fri, 20 May 2022 10:41:41 +0000</pubDate>
      <link>https://dev.to/giannisftaras/recursive-wget-and-file-transfer-10f0</link>
      <guid>https://dev.to/giannisftaras/recursive-wget-and-file-transfer-10f0</guid>
      <description>&lt;p&gt;We can simply transfer files between two PCs via the network without having to use USB sticks or other &lt;em&gt;“archaic”&lt;/em&gt; methods.&lt;/p&gt;

&lt;p&gt;We first cd to the directory we want and then run a simple python HTTP server.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Python2:&lt;/strong&gt; &lt;code&gt;python -m SimpleHTTPServer &amp;lt;port_number&amp;gt;&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;Python3:&lt;/strong&gt; &lt;code&gt;python3 -m http.server &amp;lt;port_number&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;On the other machine we then use &lt;code&gt;wget&lt;/code&gt; to recursively retrieve all the files from the remote directory.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;wget -r -np -R "&amp;lt;condition&amp;gt;" &amp;lt;remote_url&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;-r&lt;/code&gt;&lt;/strong&gt; Recursively retrieve all files and directories from the remote machine.&lt;br&gt;
&lt;strong&gt;&lt;code&gt;-np&lt;/code&gt;&lt;/strong&gt; No Parent flag. Do not ascend to the parent directory when retrieving recursively&lt;br&gt;
&lt;strong&gt;&lt;code&gt;-R&lt;/code&gt;&lt;/strong&gt;  Reject all files that match the conditions&lt;/p&gt;

&lt;p&gt;Example: &lt;code&gt;wget -r -np -R "index.html*" http://10.10.10.120:8080/&lt;/code&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Why reject index.html?
&lt;/h4&gt;

&lt;p&gt;When we use &lt;code&gt;wget&lt;/code&gt; recursively the command downloads automatically an &lt;em&gt;index.html&lt;/em&gt; file for each directory downloaded from the remote machine. With this flag we keep our downloads tidy and clean without any unnecessary files.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>File upload bypass using MIME-type</title>
      <dc:creator>Giannis Ftaras</dc:creator>
      <pubDate>Fri, 20 May 2022 10:37:43 +0000</pubDate>
      <link>https://dev.to/giannisftaras/file-upload-bypass-using-mime-type-4ej0</link>
      <guid>https://dev.to/giannisftaras/file-upload-bypass-using-mime-type-4ej0</guid>
      <description>&lt;p&gt;There are many methods web developers incorporate in their applications in order to allow only certain file types to be uploaded. In the case of a slideshow of a photo booth web application, developers mostly check for a correct file extension (.jpg , .png , etc.) as well as its mime-type &lt;code&gt;Content-type: image/jpeg&lt;/code&gt; in order to ensure that the file uploaded is indeed allowed and only an image.&lt;/p&gt;

&lt;p&gt;Bypassing the file extension to upload a payload is straightforward and easy. We just change the file extension from &lt;strong&gt;payload.php&lt;/strong&gt; to &lt;strong&gt;payload.php.gif&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The mime-type check bypass is again relatively simple but most penetration testers tend to make it seem more complicated than it really is. A good example of that is when we try to incorporate a PHP script in a regular image, which in most cases is very difficult to achieve, and it doesn’t guarantee that the payload will indeed work. This happens because in some cases the server does not recognize the file to contain executable code and it simply tries to display it as an image.&lt;/p&gt;

&lt;p&gt;The easy way is to trick the mime-type security check in order to think that the file we’ve uploaded is an image but in reality the web server is going to recognize it as a PHP script file.&lt;/p&gt;

&lt;p&gt;To do so we only need to add one line at the start of our script: &lt;strong&gt;GIF89a;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;GIF89a is a GIF file header. When the file gets reviewed by &lt;code&gt;mime_content_type("myfile");&lt;/code&gt; it gets fooled in order to think that it is an image instead of a PHP shell.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;GIF89a;
&amp;lt;?php
  system('whoami'); # shellcode goes here
?&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>kali</category>
      <category>hackthebox</category>
      <category>php</category>
      <category>mimetype</category>
    </item>
    <item>
      <title>Fast nmap scanning</title>
      <dc:creator>Giannis Ftaras</dc:creator>
      <pubDate>Fri, 20 May 2022 10:35:21 +0000</pubDate>
      <link>https://dev.to/giannisftaras/fast-nmap-scanning-g4o</link>
      <guid>https://dev.to/giannisftaras/fast-nmap-scanning-g4o</guid>
      <description>&lt;p&gt;Most of the time we need &lt;code&gt;nmap&lt;/code&gt; to just do its job and present us with any available ports that may find in its default configuration, which is usually the 1000 most popular ports. Other times though, we need to scan fast and efficiently to list only open ports in the whole spectrum without any blows and whistles.&lt;/p&gt;

&lt;p&gt;You can use any of the commands below depending on your needs.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;nmap -sC -sV &amp;lt;TARGET_IP_ADDRESS&amp;gt;&lt;/code&gt; &lt;strong&gt;Type: Normal&lt;/strong&gt;&lt;br&gt;
Scan the top 1000 most popular ports with the default nmap scripts (&lt;strong&gt;-sC&lt;/strong&gt;) and with version detection (&lt;strong&gt;-sV&lt;/strong&gt;) active.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;nmap -Pn -T4 -v1 -p- &amp;lt;TARGET_IP_ADDRESS&amp;gt;&lt;/code&gt; &lt;strong&gt;Type: Ultra Fast&lt;/strong&gt;&lt;br&gt;
Scan all ports (-p-) (0-65535) without ping (&lt;strong&gt;-Pn&lt;/strong&gt;) which helps treat all hosts as online and thus reduce the overall execution time.  We also specify the verbose mode (-v1) in order for nmap to list any open ports as soon as  it finds them and &lt;strong&gt;-T4&lt;/strong&gt; to set a higher timing template which speeds ups the process even more. For further information regarding the -T flag you can review the &lt;a href="https://linux.die.net/man/1/nmap"&gt;nmap man page&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;nmap -nvv -Pn -sS --open &amp;lt;TARGET_IP_ADDRESS&amp;gt;&lt;/code&gt; &lt;strong&gt;Type: Fast&lt;/strong&gt;&lt;br&gt;
Scan without DNS resolving (&lt;strong&gt;-n&lt;/strong&gt;), without ping (&lt;strong&gt;-Pn&lt;/strong&gt;) while using the TCP SYN scan type (&lt;strong&gt;-sS&lt;/strong&gt;) and listing only open ports (&lt;strong&gt;–open&lt;/strong&gt;).&lt;/p&gt;

</description>
      <category>enumeration</category>
      <category>nmap</category>
      <category>kali</category>
      <category>portscanning</category>
    </item>
    <item>
      <title>ERP 2 Ecommerce Project</title>
      <dc:creator>Giannis Ftaras</dc:creator>
      <pubDate>Fri, 20 May 2022 08:04:49 +0000</pubDate>
      <link>https://dev.to/giannisftaras/erp-2-ecommerce-project-al5</link>
      <guid>https://dev.to/giannisftaras/erp-2-ecommerce-project-al5</guid>
      <description>&lt;h2&gt;
  
  
  Background
&lt;/h2&gt;

&lt;p&gt;One of the most challenging tasks when in a work environment is to unite two departments that handle similar tasks. For this project we are referring to the logistics department along with our online presence such as our E-Commerce store as well as the IT department.&lt;/p&gt;

&lt;p&gt;As an example we can examine what needed to be done when product prices had to be changed in bulk. At first the logistics department had to calculate the available stock quantities and then in conjunction with an accounting supervisor calculate the new prices. These prices were then added to lists that were forwarded to the IT department for further processing and finally manually updated in the e-commerce store.&lt;/p&gt;

&lt;p&gt;This task is time consuming for both departments and lengthy both on paper as well as in real life especially if the product count was high. A solution had to be created in order to increase productivity and reduce the time spent on single tasks.&lt;/p&gt;

&lt;p&gt;A big plus for the implementation of this task is that the ERP application at the organization is able handle scripts that can be programmed directly into its general logic. Using this advantage we created a bridge that helped connect the logistics department with the online store directly. The system also had support for handling SOAP requests which helped us implement this task both ways, like introducing changes from the ERP application directly to the online store and vise versa.&lt;/p&gt;

&lt;p&gt;The E-Commerce store was developed on the Woocommerce platform which is an open source plugin used in the WordPress CMS to transform a regular blog to a full fledged online store. Woocommerce has a built-in REST API which allows us to implement a variety of tasks like updating product variables, view and update customer information, and much more.&lt;/p&gt;

&lt;p&gt;In order for the ERP application to communicate directly with the E-Commerce store an application had to be created in order to utilize the organizations needs. This was achieved by coding the required applications, as well as the ERP request handling, in the .NET programming language.&lt;/p&gt;

&lt;p&gt;Some of the core aspects needed were:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Updating products (prices, SKUs, description, stock quantities, etc.)&lt;/li&gt;
&lt;li&gt;Viewing and updating customer information&lt;/li&gt;
&lt;li&gt;Order processing&lt;/li&gt;
&lt;li&gt;Parcel tracking&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Implementation
&lt;/h2&gt;

&lt;p&gt;Before starting with all the application brainstorming we had to first configure the Woocommerce REST API properly, check its reliability and see if it matches the organizations needs. After initial setup and testing we then had to insure the implementation is secure and any third party access is prohibited. A wide range of techniques were used for security such as an HTTPS connection, rate and IP limiting, brute force protection, authentication, etc. Also a pseudo-user was created to handle read and write permissions as well as insure that the application scope was limited only to the variables needed for the implementation. We are then ready to test if the API works properly.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -X PUT https://example.com/wp-json/wc/v3/products/794 \
    -u consumer_key:consumer_secret \
    -H "Content-Type: application/json" \
    -d '{
  "regular_price": "24.54"
}'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;After thorough testing and once we are certain that the API works properly for both reading and writing variables we can then start with the main application development.&lt;/p&gt;
&lt;h2&gt;
  
  
  Development
&lt;/h2&gt;

&lt;p&gt;Every application on the planet how matter how free, open-source, or like some vendors like to call them, “unlock” there are always limitations in place that don’t match every organizations needs. The tricky part was that even though the ERP application was based on .NET, the code functionality that we could introduce was fairly limited. Because the scope of variables needed to implement was fairly big we opted to go for a man-in-the-middle application (referred to as “main application” from now on) as a result.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--VyTGNw8z--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3l0dsniizmq6h4e7kv47.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--VyTGNw8z--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3l0dsniizmq6h4e7kv47.png" alt="Application Diagram" width="272" height="300"&gt;&lt;/a&gt;&lt;br&gt;
On the ERP application the processing level was fairly limited. Several listener modules were created that would check whether the end user was saving or requesting data from the server. All this information was then divided into variables which are fed to the main application.&lt;/p&gt;

&lt;p&gt;Once the main application receives these variables it analyses the content in order to the determine the users’ needs, further process it and provide with the required result.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;



&lt;p&gt;After this procedure the application then forwards the request to the Woocommerce REST API which process it and responds appropriately.&lt;/p&gt;

&lt;p&gt;The code above is a very small snippet of how the finalized application works along with several other aspects like updating orders, error correction, exception handling and response handling. A “sidekick” to the main application had to also be created in order to log requests and responses to and from the REST API. This helped the non-tech savvy staff understand the servers’ response and act appropriately based on feedback.&lt;/p&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;The full implementation contains more that 4000 lines of code which consist of the modules mentioned above. Several information regarding the implementation were omitted for security and proprietary reasons.&lt;/p&gt;

&lt;p&gt;This project helped the logistics department tackle every day tasks more easily without having to forward them to the IT department for further implementation and correction. As an organization grows these kind of everyday tasks can be time consuming and using this method we were able to increase productivity and reduce working double time, that had to be previously done in order to achieve something as simple as updating a product’s price.&lt;/p&gt;

</description>
      <category>restapi</category>
      <category>woocommerce</category>
      <category>wordpress</category>
      <category>netframework</category>
    </item>
  </channel>
</rss>
