Sunday, 8 August 2021

SOLVED : Nmap may not work correctly on Windows Subsystem for Linux.

WSL NMAP Error:  

Warning: Nmap may not work correctly on Windows Subsystem for Linux.                                          For best performance and accuracy, use the native Windows build from https://nmap.org/download.html#windows.     

Couldn't open a raw socket. Error: Permission denied (13)




Resolution:

Install Nmap for windows :

https://nmap.org/download.html#windows

>>alias nmap='"/mnt/c/Program Files (x86)/Nmap/nmap.exe"



Thursday, 17 June 2021

Uninstall Application or Packages in Ubuntu or linux

Uninstall Application  in Linux:

To get the application package name need to uninstall :

dpkg --list


To remove all the conf and app files:
sudo apt-get --purge remove <application name>

To uninstall app files without removing config files:
sudo apt-get remove <application name>

To remove the dependencies:
sudo apt-get auto-remove

To remove downloaded archive :
sudo apt-get clean


Thursday, 1 April 2021

Day 3: Intro to Conditional Statements

Hacker rank 30days of code - Conditional statement Program:

Objective
In this challenge, we learn about conditional statements. Check out the Tutorial tab for learning materials and an instructional video.

Task
Given an integer, , perform the following conditional actions:

  • If  is odd, print Weird
  • If  is even and in the inclusive range of  to , print Not Weird
  • If  is even and in the inclusive range of  to , print Weird
  • If  is even and greater than , print Not Weird

Complete the stub code provided in your editor to print whether or not  is weird.

Input Format

A single line containing a positive integer, .

Constraints

Output Format

Print Weird if the number is weird; otherwise, print Not Weird.


 #include <bits/stdc++.h>
using namespace std;
int main()
{
    int N;
    cin >> N;
    if(N%2!=0){
        cout<<"Weird";
    }else if(N%2==0 && N>1 && N<6){
        cout<<"Not Weird";
    }else if(N%2==0 && 5<N && N<21){
        cout<<"Weird";
    }else if(N%2==0 && N>20 ){
        cout<<"Not Weird";
    }
    return 0;
}

Wednesday, 31 March 2021

c-tutorial-conditional-if-else/problem

 if else hackerrank c++ problem

Given a positive integer , do the following:

  • If , print the lowercase English word corresponding to the number (e.g., one for , two for , etc.).
  • If , print Greater than 9.

Input Format

A single integer, .

Constraints

Output Format

If , then print the lowercase English word corresponding to the number (e.g., one for , two for , etc.); otherwise, print Greater than 9.

Program:

#include<iostream>
#include<string>
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    string a[10]={"Greater than 9", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"};
    cin>>n;
    if(n>9){
        cout<<a[0]<<endl;
    }else if(0<n<=9){
        cout<<a[n]<<endl;
    }
    return 0;
}

c++ data type hackerrank basic data type 2nd problem

Since float has a precision of up to only 7 digits, it shows garbage values after its precision is exceeded.

Our double variable shows the correct number because it has a precision of 15 digits, while the number itself consists of 13 digits


Solution 1:

add header  library #include <bits/stdc++.h> and use fixed setprecision(n) in the code

cout<<fixed<<setprecision(3)<<d<<endl;
cout<<fixed<<setprecision(9)<<e<<endl;

Solution 2:

use printf:

printf("%.3f\n", f);
printf("%.9lf", z);


#include <iostream>
#include <cstdio>
#include <bits/stdc++.h>
using namespace std;

int main() {
    int a;
    long b;
    char c;
    float d;
    long double e;
    cin>>a>>b>>c>>d>>e;
    cout<<a<<endl;
    cout<<b<<endl;
    cout<<c<<endl;
    cout<<fixed<<setprecision(3)<<d<<endl;
    cout<<fixed<<setprecision(9)<<e<<endl;
    
    return 0;
}


or

printf("%.3f\n", f);
printf("%.9lf", z);


Friday, 12 February 2021

Git Commands init clone comit push pull reset hard reset soft and ammend log and status

 git init

git clone

git status

git diff index.html

+ means added 

- means deleted


unstaged and staged 

first whatever the changes it will add in 

unstaged area 

and then add the file  git add index.html

check git status for file in staged or unstaged ?


if it staged then comit the changes with some message 


git commit -m "Hello world "


git log 


whatever in the log changes with some id no 

Z:\freelance\zpp\git\makwell>git log

commit adcf8f261c015bf1cdf1dbbdcab31d8a0e867fd6 (HEAD -> master)

Author: BALA MURALI S <mur4l33@gmail.com>

Date:   Fri Feb 12 18:21:42 2021 +0530


git show adcf8f261c015bf1cdf1dbbdcab31d8a0e867fd6  

to view the exact changes in the file 



to check the specifi amunt of log


git log -5 


git branch

to check the branch 



To create a new branch 

git checkout -b "bbranch"


>git branch bbranch


to switch back to master branch 

>git checkout master


to delete the branch 

git branch -d ''bbranch"


git branch bbranch

git status 

git add

git comit 


to merge the  change to he master branch

first switch to master and then merge

git checkout master 

git merge bb

git checkout master 


do some changes on bb

comit onthat 


do delete the changes 


git reset --hard HEAD^



hard means comit and code both will get deleted 

soft means comit will get removed but code will remains there 

Z:\freelance\zpp\git\makwell>git reset --soft e7ba9fbc6d690a4ba5e1fda7939827719a7fd68e


Z:\freelance\zpp\git\makwell>git status

On branch bb

Changes to be committed:

  (use "git restore --staged <file>..." to unstage)

        modified:   index.html


remote master


push  to remote branch or master 



git checkout master 


git status 


to restore

git restore --staged  "index.html"

git status 



git pull

git log


git push



git commit --amend 


click esc

:wq 

>enter



References:

Git handbook: https://guides.github.com/introductio...​ Download Git: https://git-scm.com/downloads​


Tuesday, 1 December 2020

Top Attacks If Your Website not having an SSL Certificate

Distrust by Web Browsers:

Browsers will distrust the websites not running on “https”.
 Every browser has different ways to highlight the not secure websites to its users but the underlying
 motto is to educate the users about the non-https website.

MITM :

MITM means Man- In- The- Middle IF website does not have SSL certificate installed, all the communications traveling from your web server to client is not encrypted
 MITM attacks are easy if these types of unsecured sites

Data Leakage:

In absence of SSL certificate, Data in ur site are not encrypted at all.
Simple attack by attackers have access to all the data. 


Brand and Reputation:

Competitors can take business advantage of your non-secure website.
In-front of Customer their trust and integrity will lost. 


A Phishing Attacks:

With free cloning Tools now a days phishing attacks are easy with free SSL certificates 
if the phishing attack happened at your client side, you site owner will be responsible for the damage 


<---- Ensure u installed SSL certificates :)----->