Problem Name:  Remove Element 

Platform: leetcode


In this problem the description was very easy to understand but little hard to implement but lets start.
Briefly you want to know the size of the last ward in a string given by user.

Algorithm :
  • First check if the array is empty.
  • Get the length of the array,
  • Create a for loop starts from the end of the string to get the last word index of the string.
  • Start counting down until you got space then the word end,
  • Return the size of the last word.
The parameter given:
Array of character contains the string given by the user.


We will use ctype library to check if the character is space or not.



BINGOO













58. Length of Last Word

Posted by : Abdallah Rabie 0 Comments
Tag : , ,

Problem Name:  Remove Element 

Platform: leetcode



This problem is so close to the previous Remove Duplicates From Sorted Array 
This problem have 2 solution one wasting memory but pretty easy and the other is small code but much headache lets start.
The problem want to remove a specific element  given by the user in every place in the array and return the size of the new array.
The function given by the platform have 3 parameter:
  1. the given array 
  2. the size of the array
  3. the value need to be removed



First algorithm:
  • Create new array and a new variable with initial value 0 to store the new size.
  • Check every element in the given array if the element not equal to value given by the user store it in the new array and increment the 
  • return  the variable 


Second algorithm:

  • this algorithm is to close to the Remove Duplicates From Sorted Array  Algorithm 
  • Create a for loop to go though the whole array and create a new variable with initial value 0 to store the new size.
  • Check if the element not equal to the value store this value in the array with index variable you created in the first step and increment the the variable with 1.
  • Return the new size array.




and finally 






27. Remove Element

Posted by : Abdallah Rabie 0 Comments
Tag : , ,

 Problem Name: Remove Duplicates From Sorted Array 

Platform: leetcode

Link: Remove Duplicates From Sorted Array


As shown as in figure this problem has too much word unless it is very easy and its algorithm is very small lets start. briefly the problem want to remove the duplicated values from array and return the size of new array with some constraint :
  • Without making any space for another array. 
  • To modify the new array to be sorted.
The function has 2 parameter the array , the size  and the returning data type is int. 


The algorithm :
  • Create for loop to go through the whole array and create index variable with finial value 1 to return the array size.
  • Check the first element with the second element if not equal that means that there is no equilty between this two element so store the the n+1 element  in the num index.
  •  Go on for the whole array and return the final array size. 
Bingoo...












26. Remove Duplicates from Sorted Array

Posted by : Abdallah Rabie 0 Comments
Tag : , ,

Problem Name : Plus One

Platform : leetcode

Language: Javascript

Link : Plus One


In this problem you have a number which represented by an array where every element of the array represents a digit of the number,  for example the number 123 is represented as [1 , 2 , 3].


You are required to increase the given number by 1 and return it as an array.

 

So your gonna add one to the last element of the array and boom you solved the problem..... well if you do that and submit your answer you will get an error because if the last digit is 9 say the number is [1 , 2 ,  9] and increased by 1 it will be [1 , 2 , 10]  instead of  [1 , 3 , 0]. in that case i we found that the last digit is 9 we gonna make it  0 and increase the next digit by one and we good to go..



Oops.. you get another error๐Ÿ˜๐Ÿ˜‚.  because if we get a number that the next digit is also 9 say 1299, we will get the same problem but on a different digit this time, the solution is simple we need to loop through the digits and do the last step on every one of them.


Well we still have a little problem here if we got a number that all of it's digits is 9s say 99, according to our code the answer will be 00 , and the solution to that is to make the firist digit 1 and add 0 to the back of the array.


Enough talking and let's dive to the algorithm:

  • loop through the array starting from the last element(firist digit).
  • Creat an if statment inside the for loop, if the digit is not 9 we increase it by 1 and break (exit) the for loop.
  • If it's 9 we make it 0 and repeat the steps on the next digit until we break the loop.
  • The last step is to check if the first elemnt of the array is 0 we make it 1 and push 0 in the back of the array.


And  yay✌












66. Plus One

Posted by : Mostafa Mazhar 0 Comments

 

 

 

Phases of penetration testing activities include the following:


    Planning – Customer goals are gathered and rules of engagement obtained.
    Discovery – Perform scanning and enumeration to identify potential vulnerabilities, weak areas, and exploits.

    Attack – Confirm potential vulnerabilities through exploitation and perform additional discovery upon new access.

    Reporting – Document all found vulnerabilities and exploits, failed attempts, and company strengths and weaknesses.


scope

assessment Details
Internal & external Penetration Test 10.10.266.244


Vulnerability Summary

Finding Severity
weak password High
RCE High
token impersonation High


THM : Alferd

Posted by : moamjad 0 Comments
Tag : ,

 

 

ุงู„ุณู„ุงู… ุนู„ูŠูƒู… ูˆุฑุญู…ุฉ ุงู„ู„ู‡ ูˆุจุฑูƒุงุชู‡

ุงู„ู„ู‡ู… ุนู„ู…ู†ุง ู…ุง ูŠู†ูุนู†ุง ูˆุงู†ูุนู†ุง ุจู…ุง ุนู„ู…ุชู†ุง ูˆุฒุฏู†ุง ุนู„ู…ุง

ุฑุงุจุท ุงู„ู…ุงุฏุฉ: http://iswy.co/e28dqd
ุงู„ู„ู‡ู… ุนู„ู…ู†ุง ู…ุง ูŠู†ูุนู†ุง ูˆุงู†ูุนู†ุง ุจู…ุง ุนู„ู…ุชู†ุง ูˆุฒุฏู†ุง ุนู„ู…ุง

ุฑุงุจุท ุงู„ู…ุงุฏุฉ: http://iswy.co/e28dqd
ุงู„ู„ู‡ู… ุนู„ู…ู†ุง ู…ุง ูŠู†ูุนู†ุง ูˆุงู†ูุนู†ุง ุจู…ุง ุนู„ู…ุชู†ุง ูˆุฒุฏู†ุง ุนู„ู…ุง

ุฑุงุจุท ุงู„ู…ุงุฏุฉ: http://iswy.co/e28dqd

ุงู„ู„ู‡ู… ุนู„ู…ู†ุง ู…ุง ูŠู†ูุนู†ุง ูˆุงู†ูุนู†ุง ุจู…ุง ุนู„ู…ุชู†ุง ูˆุฒุฏู†ุง ุนู„ู…ุง  

Intro

In this lab, you will learn and explore the following topics:

  • .NET basics
  • Web application exploitation
  • AV evasion
  • Whitelist and container escapes
  • Pivoting
  • Operating with a C2 (Command and Control) Framework
  • Post-Exploitation
  • Situational Awareness
  • Active Directory attacks

You will learn and exploit the following attacks and misconfigurations:

  • Misconfigured subdomains
  • Local file Inclusion
  • Remote code execution
  • Docker containers
  • SUID binaries
  • Password resets
  • Client-side filters
  • AppLocker
  • Vulnerable DLLs
  • Net-NTLMv2 / SMB

 

THM:HOLO -> Part 1

Posted by : moamjad 0 Comments
Tag : ,

 Subdomain Enumeration — TryHackMe Walkthrough 2022 | by Pratik Dhavade |  System Weakness


 # Finding subdomains used by the target organization is an effective way to increase the attack surface and discover more vulnerabilities.  
 # The script will use a list of potential subdomains and prepends them to the domain name provided via a command-line argument.  
 # The script then tries to connect to the subdomains and assumes the ones that accept the connection exist.  
 
import requests      #The requests module allows you to send HTTP requests using Python. 
import sys              # The sys module provides functions and variables which are used to manipulate different parts of the Python Runtime Environment. It lets us access system-specific parameters and functions 

#make a subdomain list and read it 

sub_list = open("subdomains.txt").read() 
subdoms = sub_list.splitlines() 					# The splitlines() method splits a string into a list. The splitting is done at line breaks. 

# Create For loop to take the list of subdomains (subdomains)  and run http request  

for sub in subdoms:
    sub_domains = f"http://{sub}.{sys.argv[1]}" 

    try:
        requests.get(sub_domains)    	 			#make a GET Request 
    
    
    except requests.ConnectionError:  			# IF the Request  Failed then Pass 
        pass
    
    else:
        print("Valid domain: ",sub_domains)   
        

Python : subdomains Enumeration

Posted by : moamjad 0 Comments
Tag : ,

 

Directory Enumeration

import requests 
import sys 

sub_list = open("wordlist.txt").read() 
directories = sub_list.splitlines()

for dir in directories:
    dir_enum = f"http://{sys.argv[1]}/{dir}.html" 
    r = requests.get(dir_enum)
    if r.status_code==404: 
        pass
    else:
        print("Valid directory:" ,dir_enum)

Python: Directory Enumeration

Posted by : moamjad 0 Comments
Tag : ,
Problem : Fizz Buzz
Platform : leetcode
Language: Javascript
Link : Fizz Buzz

Fizz Buzz is a cool game where you will just simply start saying the numbers starting from 1 then 2 and 3 and so on, but there is a little tricky part, if the number is divisible by 3 you have to say "fizz" instead of the number.

Similarly if the number is divisible by 5 you have to say "Buzz".

Wiat.. we still have one last trick, if the number is divisible by 3 and also divisible by 5 (ex : 15) you have to say "FizzBuzz".

In this problem you are given (n) the number of elements in the game, you need to creat an array starting from 1 and emds at (n). and surely you have to follow the rules of the game.

Algorithm:
  • First creat an array to contain the numbers (answer).
  • Make for loop to start filling the array with (n) elements.
  • We use the modulo operator(%) to see if the number is divisible by 3 or 5 or both.
  • If the number is divisible by 3 and 5 we push : "FizzBuzz" into the array.
  • If it is divisible by 3 we push : "Fizz".
  • If it is divisible by 5 we push : "Buzz".
  • And if it is not divisible by any then we simply push the number as a string into the array.
  • When we finish the numbers we return the (answer) array.


Notice here we used the number 15 to cheek if the number is divisible by both 3 and 5, because if you think about it if a number is divisible by 3 and 5 it must be divisible by 15 (3 * 5).
You can also use the logical AND operator (&&) inside the if statment instead .

And we sarted the if statment with that condition because if we replace it with any other condition say the (3) for example, if the number is divisible by 3 and 5 the program will first check if the number is divisible by 3 (which is true) so it will push "Fizz" instead of "FizzBuzz" and exit the if statment without checking if it's also divisible by 5 or not.













412. Fizz Buzz

Posted by : Mostafa Mazhar 0 Comments
Problem name : Fibonacci number 
Platform : leetcode
Language: Javascript
In this problem you are given an index (n) and required to return the number on that index in the Fibonacci sequence.

The Fibonacci sequence is a simple sequence starts with (0 , 1) and then each number is the sum of the previous two numbers, so the sequence becomes :  (0 , 1 , 1 , 2 ,  3 , 5 , 8 , 13 , 21 , 34 , 55 ,.....etc.).

So for example if the given index is 7 the returned value is 13 .
remember: Computers always start counting from 0 not 1.

Algorithm:
  • if the index is 1 or 0 the returned value will be the same as index itself.
  • but if the index is larger we will need to create the Fibonacci sequence (fibSequance).
  • we will create an array that have 0 and 1 as the first two elements.
  • then we will loop through the array starting from the third element(2 as index).
  • and we will push into the array the sum of the two previous elements (index (i-1) and (i-2)).
  • at last we will return the element on the (n) index.












509. Fibonacci Number

Posted by : Mostafa Mazhar 0 Comments
Problem name: palindrome number 
Platform: leetcode
Link: Palindrome number

In this problem you have to return Boolean (True or False) and you have to figure out if the number given by the user is Palindrome. but let me Explain the examples first

Example 1

The input was 121 when you read the number from left to right it gives the same value form right to left so it called palindrome number.

Example 2 

Then you read a negative number such as -121 from right to left it gives you -121 if you read from left to right it gives you 121- it is not the same value right ?

The function given from the platform it takes one integer parameter int x.


The Algorithm:

  • First you have to check the number greater than 0 (not a negative number) else return False.
  • Second catch every digit number and reverse it.
  • Third if it equals the actual value given by the user then it is palindrome number.



Bingooo 









9. Palindrome Number

Posted by : Abdallah Rabie 0 Comments
Tag : , ,
Problem name: Two Sum  
Plat Form: Letcode 
Link: Two sum



Problem description

The task is to return the indices of the elements that specify the target input. so in example 1 the 
input [2,7,11,15]
the target to get the indices which make the target=9
the answer is 0,1 because 2 (which index is 0) + 7 (which index is 1) make the target 9 

to do the task the function given have 4 parameters :
  • int* nums: the array given by the user 
  • int numsSize: size of the array
  • int target:  the target value 
  • int* returnSize: the array that hold the size of array which accomplish the task 

Algorithm 
  • First create an array to hold the answer (If you don't know how to request a memory space 
  • Second make 2  for loops to get the consecutive indices then, check if the sum of the two values equal to the target then assign the value in the array and return the array. if now try the next loop until you find the answer. 
  • Finally don't forget to free the mallocated array ^^ .


  







  

1. Two Sum (LetCode)

Posted by : Abdallah Rabie 0 Comments
Tag : , ,

- Copyright © Quarks - Blogger Templates - Powered by Blogger - Designed by Johanes Djogan -