Problem Name: Remove Element
Platform: leetcode
- 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.
58. Length of Last Word
Problem Name: Remove Element
Platform: leetcode
- 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
- 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.
27. Remove Element
Problem Name: Remove Duplicates From Sorted Array
Platform: leetcode
Link: Remove Duplicates From Sorted Array
- Without making any space for another array.
- To modify the new array to be sorted.
- 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.
26. Remove Duplicates from Sorted Array
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
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
ุงูุณูุงู ุนูููู ูุฑุญู ุฉ ุงููู ูุจุฑูุงุชู
ุฑุงุจุท ุงูู ุงุฏุฉ: 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
# 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
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
- 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.
412. Fizz Buzz
Language: Javascript
- 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
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
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.
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 ?
9. Palindrome Number
Plat Form: Letcode
Link: Two sum
- 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
- 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 ^^ .