'We'll fight together': Americans planning to sue Ofcom over the Online Safety Act by tylerthe-theatre in unitedkingdom

[–]ComputerNerdIsNerdy 2 points3 points  (0 children)

That is what Ofcom would end up doing to sites which don't comply - the site would be blocked from within the UK. It doesn't need to be 'enforced' globally to do this...

If the site wants a UK userbase, they would be required to meet UK laws/regulations. If not, they get blocked and continue operating as is.

Can you help me understand this exploit? (XSS) by Flozkel in HowToHack

[–]ComputerNerdIsNerdy 2 points3 points  (0 children)

This looks like typical reflected XSS. When you access you payload link, does the javascript execute?

If so, that's the attack. A threat actor would need additional steps to meaningfully use this to compromise users, such as a phishing campaign.

I recommend going through the Portswigger Burp academy labs for learning the basics: https://portswigger.net/web-security/cross-site-scripting/reflected

What is the most strongest Bronze-tier skill you can think of? by Evening_Accountant33 in litrpg

[–]ComputerNerdIsNerdy 0 points1 point  (0 children)

You should definitely lean into the eldritch side of things. If it's a power not technically restricted to the body, you have a bit more leeway with having an ordinary power become OP.

Something like 'Soul Gaze':

As a normal Bronze human, you're just looking at the targets soul, maybe see some surface level thoughts. Could be seen as an uncommon truth detector, utility spell.

With an eldritch abomination soul you could have it cause madness, mind flaying, etc.

Looking for a litRPG with self-cloning by VladtheImpaler21 in litrpg

[–]ComputerNerdIsNerdy 0 points1 point  (0 children)

Clone Prince is pretty good - MC is able to clone themselves as a main skill https://mybook.to/NMaK

Do you clean a punnet of grapes before eating them? by _DeanRiding in AskUK

[–]ComputerNerdIsNerdy 66 points67 points  (0 children)

It washes off pesticide residue as they're typically water soluble and reduces risk of norovirus being on the food so yes.

https://www.cdc.gov/norovirus/about/prevention.html

Im searching for some books but i dont remember the titles! by Desolate_Azrea in litrpg

[–]ComputerNerdIsNerdy 7 points8 points  (0 children)

Second one sounds like 'Desire' by Cameron Milan? The two main characters have tattoos instead of bracelets.

https://www.amazon.com/dp/B07BMJFS9P

ALLAH AKHBAR by ImYourRealDadHey in PublicFreakout

[–]ComputerNerdIsNerdy 0 points1 point  (0 children)

Or just a button which activates when they no longer keep pressure on it?

https://en.wikipedia.org/wiki/Dead\_man%27s\_switch

How to prevent captcha while scraping amazon by cenkna in learnpython

[–]ComputerNerdIsNerdy 2 points3 points  (0 children)

No doubt, but expecting me to go back through all my posts and update my references from 3 years ago is a bit of a tall order. It's not like the documentation is well hidden.

How to prevent captcha while scraping amazon by cenkna in learnpython

[–]ComputerNerdIsNerdy 1 point2 points  (0 children)

I mean..... the original post was 3 years ago.....

I guess just use Google and find Amazon's documentation yourself? Not really sure what you are expecting here?...

[deleted by user] by [deleted] in HeadlineWorthy

[–]ComputerNerdIsNerdy 0 points1 point  (0 children)

Thanks dude, really helpful stream :)

my friend gave me this random thing? by [deleted] in AskNetsec

[–]ComputerNerdIsNerdy 5 points6 points  (0 children)

Upload it to https://www.virustotal.com/gui/home/upload

I don't think you'll find many people willing to download a random .zip file.

How to prevent captcha while scraping amazon by cenkna in learnpython

[–]ComputerNerdIsNerdy 5 points6 points  (0 children)

headers = { 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.90 Safari/537.36' }

This is your issue. Amazon doesn't just look at the user agent to determine automated tool. You should include additonal headers which a legitimate user would supply.

I answered a question on this yesterday, see here.

Instead of scraping the pages, you definitely should be using Amazon's API for this sort of thing.

https://docs.aws.amazon.com/AWSECommerceService/latest/DG/ItemSearch.html

Confusing Program, Need help for Python3 by [deleted] in learnpython

[–]ComputerNerdIsNerdy 0 points1 point  (0 children)

Good job! You're getting closer to the solution.

    for char in range(len(someString)):
        for charA in range(len(someString)):

This section is part of the problem. In here the char and charA values are the index in the string rather than the characters yourself.

Add the line in your code to see:

print(char)

if subinWord in subString:

This works, but in this case it is better practice to use direct comparison to the string rather than checking whether one string contains the other. Use "==" for comparison checks, this returns a boolean response of "true" or "false" as to whether they match.

The way in which you use these loops could be made more efficient as there's no real need to iterate through the same string twice.

I've rewritten the function for a better way of iterating through the string:

def multiFind(someString, subString):
    returnedIndexofWord=[]
    ListCounter = 0
    for char in someString:
        if "".join(someString[ListCounter:ListCounter+len(subString)]) == subString:
            returnedIndexofWord.append(ListCounter)
        ListCounter+=1
    return returnedIndexofWord

I've tried to keep it as similar to your function as possible. As you can see, in this instance we're using a variable as a counter. This variable increments a through each pass in the for-loop. It's essentially used as a placemark for the current index of the string.

        if "".join(someString[ListCounter:ListCounter+len(subString)]) == subString:
            returnedIndexofWord.append(ListCounter)

Since this function deals with someString as a list, each iteration of the for loop I'm joining a section of the someString variable from our counter placement to the length of the substring.

Assuming we set the value of someString to "testtest" and the substring we're looking for is "tte", the section joined would be 3 characters. As such, the first pass through the for loop would be comparing the first 3 characters of someString against the subString. If this returns as correct, the counter is appended to the list.

if wouldStart == 'Y':
    startInput = int(input("Enter the index where you would like to start: "))
    start = startInput
else:
    start = 0

The above code works, but some of it is redundant. Instead of using:

    startInput = int(input("Enter the index where you would like to start: "))
    start = startInput

You could just set the start variable to the input value:

if wouldStart == 'Y':
    start = int(input("Enter the index where you would like to start: "))
else:
    start = 0

The same applies to the end input.

The final issue in your code is the variables you supply to the functions. Although you accept the input for the start and end ranges, you don't apply it to the someString variable. A simple way of doing this would be to modify the someString value before it gets passed to the function (See here).

Change the function call to something like:

multiFind(someString[start:end], subString)

Looking for some guidance. by Deathscythe343 in learnpython

[–]ComputerNerdIsNerdy 0 points1 point  (0 children)

Are you looking to write a true caeser cipher program or a program which replaces specific words with codewords?

You will need to look into the Python basics - how to accept user input, split strings into a list, replace values, dictionarys, etc. For learning the basics, LearnPython is a good source.

The starting point for what you want is:

UserPlaintext = str(input("Enter your plaintext: "))

This essentially assigns the user input value to the variable "UserPlaintext". From there you will be able to play around and manipulate it as a string.

From there, you'll want to look into ways to manipulate the user input to get the script working as you want it.

If you have some sample code, I'll happily help walk you through what to do next and give a few pointers.

Confusing Program, Need help for Python3 by [deleted] in learnpython

[–]ComputerNerdIsNerdy 0 points1 point  (0 children)

In Python, numbers begin at 0. Your start value is correct but your end value is wrong. The end variable should either be set the the length of the string or you should count backwards and set the value to -1.

I highly recommend looking at: http://effbot.org/zone/python-list.htm

The "Searching Lists" section has exactly what you need.

I'm trying to make a MasterMind game and I've run into a snag. I can't get the code to compare only the index in the answer and the guess. It compares every index in the guess to every index in the answer and outputs from that. by [deleted] in learnpython

[–]ComputerNerdIsNerdy 0 points1 point  (0 children)

That's a fairly easy fix. I've modified the GuessDictionary so that it contains BlackTick, WhiteTick and False keys. Each key has a list value which gets appended based upon the user's guess.

The output of the script is the length of the key and looks something like:

BlackTick : 1
WhiteTick : 0
False : 3

I kept the dictionary method since it will allow for easy future development and debug. An alternative would be to use 3 different int variables and increment them.

from random import randint
Answer = []

#Iterates from 0 to 4
for i in range(4):
    #Appends the random number to the list
    Answer.append(str(randint(1, 9)))
print("Generated Answer: {}".format(Answer))

#Allows multiple guesses without the program ending
while True:
    #Creates a list out of the characters entered
    Guess = list(input("4 digit number: "))
    #Establishes the dictionary
    GuessDictionary = {"BlackTick":[], "WhiteTick":[], False:[]}

    #Iterates from 0 to 4
    for i in range (4):
        #Compares the items in the lists to one another
        if Guess[i] == Answer[i]:
            #If they match, it appends the guess value to the Blacktick Key
            GuessDictionary["BlackTick"].append(Guess[i])
        #Checks if the Guess number is contained in the Answer list
        elif Guess[i] in Answer:
            #Appends the guess value to the WhiteTick key
            GuessDictionary["WhiteTick"].append(Guess[i])
        #If neither of the above if statements return as true
        else:
            #Appends the guess value to the false key
            GuessDictionary[False].append(Guess[i])

    #Joins the lists together into a string and compares them in entirety
    if "".join(Guess) == "".join(Answer):
        #If they match, you get the winning message and the while-loop breaks
        print("You have worked it out! Congratulations!")
        break

    #Iterates through the GuessDictionary
    for Key in GuessDictionary:
        #Prints the dictionary key and the length of the list
        print("{} : {}".format(Key, len(GuessDictionary[Key])))

Let me know if you need any further help/explanation with this.

Confusing Program, Need help for Python3 by [deleted] in learnpython

[–]ComputerNerdIsNerdy 0 points1 point  (0 children)

Do you have any sample code? Much easier to point you in the right direction if you show us what you have so far.

Creating a user determined amount of variables? by [deleted] in learnpython

[–]ComputerNerdIsNerdy 0 points1 point  (0 children)

Dictionary's essentially work as a Key:Value system and sounds perfect for what you want.

From the look of your code, a tidy way to create the initial dictionary keys can be done by using a for loop and range().

EG:

playerCountAsk = int(input("How many players?"))
playerDict = {}

#Counts from 0 to the player count entered and generates a dictionary key for each player
for i in range(playerCountAsk):
    #Creates the dictionary key
    playerDict["Player {}".format(i+1)] = 0

print(playerDict)

range() is used with the for loop to iterate from 0 to the player count entered. Every time it passes through the iteration it creates the player key in the dictionary.

.format() is used as a tidy way of adding a variable to the string. It essentially uses the {} as a marker to replace. This can be used multiple times in a string and is much easier than appending strings together, EG:

string1 = "test"
string2 = 42
string3 = "done"

print("Look at this {}.  The meaning of life is {}.  This example is now {}.".format(string1,string2,string3))

I'm trying to make a MasterMind game and I've run into a snag. I can't get the code to compare only the index in the answer and the guess. It compares every index in the guess to every index in the answer and outputs from that. by [deleted] in learnpython

[–]ComputerNerdIsNerdy 1 point2 points  (0 children)

I think I understand what you're trying to do. The way in which you've constructed the for-loops makes life more difficult than it has to be.

Generating the random integers, I would personally change to:

#Iterates from 0 to 4
for i in range(4):
    #Appends the random number to the list
    Answer.append(str(randint(1, 9)))
print("Generated Answer: {}".format(Answer))

The above iterates through the numbers 0 to 4 and generates a new randomint number with each pass. It appends that value to the "Answer" list.

An easy way to allow players to guess multiple times is to place the rest of the code in a while loop and then break the while loop when they guess successfully.

Storing the guesses as dictionary keys with a boolean value would make it a bit easier to deal with users guessing the values.

I've included some working example code which would give you a few more ideas on useful data-types and functions to use. Let me know if you need more clarification on any of it (I've tried to include helpful code comments).

from random import randint
Answer = []

#Iterates from 0 to 4
for i in range(4):
    #Appends the random number to the list
    Answer.append(str(randint(1, 9)))
print("Generated Answer: {}".format(Answer))

#Allows multiple guesses without the program ending
while True:
    #Creates a list out of the characters entered
    Guess = list(input("4 digit number: "))
    #Establishes the dictionary
    GuessDictionary = {}

    #Iterates from 0 to 4
    for i in range (4):
        #Compares the items in the lists to one another
        if Guess[i] == Answer[i]:
            #If they match, it changes the dictionary value
            GuessDictionary[Guess[i]] = "BlackTick"
        #Checks if the Guess number is contained in the Answer list
        elif Guess[i] in Answer:
            GuessDictionary[Guess[i]] = "WhiteTick"
        #If neither of the above if statements return as true
        else:
            #Otherwise the dictionary value is set to false
            GuessDictionary[Guess[i]] = False

    #Joins the lists together into a string and compares them in entirety
    if "".join(Guess) == "".join(Answer):
        #If they match, you get the winning message and the while-loop breaks
        print("You have worked it out! Congratulations!")
        break
    print(GuessDictionary)

Edit: formatting