hash – HaveIBeenPwned API – Code Review Stack Exchange

Please find my code for securely checking Haveibeenpwned for breached passwords

This code will only send a partial HASH over the internet (using HTTPS) and the second part of the HASH will be checked on the users side. Therefore, the full password will never be seen by anyone including haveibeenpwned

import hashlib
import urllib.request

def check_password(firstHash, lateHash):
    link = f"https://api.pwnedpasswords.com/range/{firstHash}"
    f = urllib.request.urlopen(link)
    for line in f.readlines():
        searchedHash, hashCount = str(line, "utf-8").strip().split(":")
        if searchedHash.lower() == lateHash.lower():
            return (f"This password has been breached {hashCount} time(s)")
    return ("This password has not been breached")

def hash_password(password):
    encoded_password = password.encode("UTF-8")
    SHA1Hash = hashlib.sha1()
    SHA1Hash.update(encoded_password)
    return SHA1Hash.hexdigest()

def main():
    password = input("Please enter your password: ")
    fullHash = hash_password(password)
    firstHash, lateHash = fullHash(0:5), fullHash(5:)
    print(check_password(firstHash, lateHash))

if __name__ == "__main__":
    main()

Review: TagMovies.co | NewProxyLists – Webmaster Forum

Hi id like to have review on my AD-Free Movies, TV Series & Anime in HD & Bluray
the website link is https://tagmovies.co/ if someone can give a review that good or bad. i really appreciate. thanks in advance.
Website is brother site of TagAnime.com & TagDrama.co

java – Message handler – Code Review Stack Exchange

The code bellow is code of “Hello” message handler. It works, but I really don’t like as it looks.
The “hello” protocol contains three messages:

  1. client -> server: diffie-hellman client public parameters
  2. server -> client: diffie-hellman server public parameters
  3. client -> server: used data

Could you please review the code. Any comments are welcome.

public class HelloHandler implements Runnable {

    final private static int MSG_TIMEOUT = 5000; // Response receive timeout in milliseconds

    final private static Server server = Server.getInstance();
    final private static Logger logger = server.getLogger();
    final private static ClientsRepository repository = server.getClientsRepository();

    final private static Map<SocketAddress, HelloHandler> handlers = new ConcurrentHashMap<SocketAddress, HelloHandler>();

    final private SocketAddress address;

    private DatagramPacket keyExchange = null;
    private DatagramPacket userData = null;
    private CipherPair ciphers;

    /*
     * Handles all hello messages
     * This method runs in context of the main thread (server)
     */
    public static void handle(DatagramPacket packet) {

        SocketAddress address = packet.getSocketAddress();
        byte type = PacketParser.getHeader(packet);

        if (type == DH_EXCH) {  //DH exchange starts

            if (handlers.containsKey(address) || repository.containsKey(address)) {
                logAndSend(REJECT, "Already active", address);
                return;
            }

            HelloHandler handler = new HelloHandler(packet);
            handlers.put(address, handler);
            server.getExecutor().execute(handler);
            return;
        }

        if (type == USER) { //user sent it's data

            HelloHandler handler = handlers.get(address);

            if (handler == null) {
                logAndSend(TIMEOUT, "Timeout", address);
                return;
            }

            handler.handleUser(packet);
        }

    }

    private HelloHandler(DatagramPacket packet) {
        keyExchange = packet;
        address = packet.getSocketAddress();
    }

    private void handleUser(DatagramPacket packet) {
        if (userData == null)
            userData = packet;
    }

    @Override
    public void run() {

        DatagramPacket packet;

        try {

            packet = processKeyExchange();
            server.send(packet);

            keyExchange = null; // help GC

            packet = waitForPacket();

            if (!server.isRunning())
                return;

            if (packet == null) {
                logAndSend(TIMEOUT, "Timeout", address);
                return;
            }

            packet = processUserData();
            if (packet != null)
                server.send(packet);

            return;

        } catch (NullPointerException | IOException e) { // we cannot be here
            logger.severe("Hello handler: " + e.getMessage());
            return;
        } catch (IllegalMessageException e) {
            logAndSend(ILLEGAL_MSG, e.getMessage(), address);
            return;

        } finally {
            handlers.remove(address);
        }
    }

    private DatagramPacket waitForPacket() {
        
        // Use the simplest polling
        long timeOutTime = System.currentTimeMillis() + MSG_TIMEOUT;
        boolean timeOut = false;
        
        while (userData == null && !timeOut && server.isRunning()) {
            try {
                Thread.sleep(100);
            } catch (InterruptedException e) {};
            
            timeOut = System.currentTimeMillis() >= timeOutTime;
        }
        
        return userData;
    }

    /*
     * Process first message (key exchange) sent by client
     * throws IllegalMessageException if we cannot get public key from message 
     */
    private DatagramPacket processKeyExchange() 
    throws NullPointerException, IOException, IllegalMessageException {

        try {
            Message<DHPublicKeyParams> message = PacketParser.parse(keyExchange, DHPublicKeyParams.class);
            DHPublicKeyParams clientKeyExchangeParams = message.getData();

            SecurityHelper security = SecurityHelper.getInstance();
            DHPublicKeyParams serverKeyExchangeParams = security.getPublicKeyParams();

            ciphers = security.finalizeAggreement(clientKeyExchangeParams);
            return PacketBuilder.build(DH_EXCH, serverKeyExchangeParams, address);

        } catch (InvalidKeyException | InvalidKeySpecException e) {
            throw new IllegalMessageException(e);
        }
    };

    /*
     * Currently it is a dummy method that shows that we can read encrypted data
     */
    private DatagramPacket processUserData() 
    throws NullPointerException, IOException, IllegalMessageException {

        Message<UserData> message = PacketParser.parse(userData, ciphers.getReadCipher(), UserData.class);

        System.out.println(message.getData().toString());
        repository.put(message.getData());

        return null;

    };

    /*
     * logs error and send response to client 
     */
    private static void logAndSend(byte type, String text, SocketAddress address) {
        logger.warning(buildMessage(text, address));
        server.send(PacketBuilder.build(type, text, address));
    };

    
    private static String buildMessage(String text, SocketAddress address) {

        StringBuilder sb = new StringBuilder();
        sb.append("Hello handler: ");
        sb.append(text);
        sb.append(" form: ");
        sb.append(Util.sockAddrToString(address));

        return sb.toString();

    }

}

Can anyone review my WebChainEVO project?

Hi,

Admin: If i can’t share my project here, please remove this thread. Thanks

WebChainEVO is a recent site that i created to share my favorite content and my tools…
Visit: http://www.webchainevo.oxn.pl

Thanks

Can anyone review my newest resource? > hacxx.xsbb.nl

Hi,

Can anyone review my newest resource?

Visit: http://hacxx.xsbb.nl

This site has been build to provide users with APKs for android phones, fresh accounts and account i no longer use, website reviews and Off Topic subjects. Have a look and give me your feedback…

python – HackerRank itertools.combinations() – Code Review Stack Exchange

Nice solution, these are my suggestions:

The combination tuples are emitted in lexicographic ordering according
to the order of the input iterable. So, if the input iterable is
sorted, the combination tuples will be produced in sorted order.

So, instead of sorting each combination, it’s enough sorting the input S at the beginning and all the combinations will be automatically sorted.

  • Use the output of itertools.combinations: the output of itertools.combinations is an iterable or tuples, which can be used in a for-loop to print the combinations one by one. The only change is to convert the tuple to a string, and can be done with string.join.

Revised code

from itertools import combinations

S, k = input().split()
S_sorted = ''.join(sorted(S))
for i in range(1, int(k)+1):
    for c in combinations(S_sorted, i):
        print(''.join(c))

SEO Review

this is my website https://xfinitivetechnologies.com/ wanted to get some strategies to rank this website

✅LEGIT – AutoClaim.in Review: SCAM or LEGIT? | NewProxyLists

Firstly, I need you to know that this site is almost completely similar in operation just like AUTOFAUCET.ORG
At the same time completely different.

HOW CAN I EARN?
There are 3 different claim categories. You can claim over “Auto claim” menu for getting coins automatically, over “Manual claim” or over “Level up” menu for leveling up in FaucetHub .

YOU NEED TO KNOW
Thereʼs no miner on any part of website.

The best thing about this site is that there’s no waiting period between claims. Just keep claiming and claiming and continue getting paid directly to your faucethub account.

20% referral bonus!!

START TO CLAIM FREE COINS VIA –> AUTOCLAIM.IN

Screenshot_2018-08-28-14-45-10.png

python: subprocess opening filles – Code Review Stack Exchange

I am using 2 functions written in python to convert DLG file to PDB energies

import glob
import os
import subprocess
import numpy as np
from vmd import vmdnumpy as vnp
from vmd import Molecule
from vmd import atomsel

def dlg_to_multiframepdb(fname):
        inputstrings = subprocess.check_output("grep "DOCKED:" %s" % fname, shell=True).split("n")
        output = ""
        for s in inputstrings:
                if s(8:12) == "ATOM" or s(8:12) == "HETA":
                        output += s(8:) + "n"
                elif s(8:14) == "ENDMDL":
                        output += "ENDMDLn"
        return output
        
def dlg_to_energy(fname):
        inputstrings = subprocess.check_output("grep "Estimated" %s | sed 's/=//g' | awk '{print $8}'" % fname, shell=True).split("n")(:-1)
        energies = np.array(inputstrings).astype(np.float)
        return energies

# simple code: loop over the directory of DLG filles and convert each file to PDB
pwd = os.getcwd()
dlg= 'dlg'
#set directory to analyse
data = os.path.join(pwd,dlg) 

dirlist = (os.path.basename(p) for p in glob.glob(data + '/*.dlg'))
os.chdir(data)
for dlg_file in dirlist: 
      energies = dlg_to_energy(dlg_file)
      pdb = dlg_to_multiframepdb(dlg_file)

Briefly, the first function take some part from the initial file using shell utility GREP, skiping some unused strings; and the second function – use GREP + SED to take specific strings from the same file and store it as numpy array
The problem, while it worked properly with python 2.7, in python 3 I had the following error just trying to open input file:

File "<stdin>", line 1, in <module>
  File "DLG_test.py", line 21, in dlg_to_energy
    inputstrings = subprocess.check_output("grep "Estimated" %s | sed 's/=//g' | awk '{print $8}'" % fname, shell=True).split("n")(:-1)
TypeError: a bytes-like object is required, not 'str'

Ki Residences Review By Hoi Hup

Ki Residences will be launching soon with some exciting great potential on this exciting development.Ki Residences review was recently done with a special invitation by the developers to have a sneak peak of what is being offered in one of their maiden projects in Singapore.Ki Residences launch prices will be exciting to watch out for and is closely watched by many potential buyers due to its prime residential enclave, a brookvale and sunset residential enclave. This locale is perfect for both home stay and investment.There are also many little hidden heaven around the development itself, especially of which a first hand movers advantage and potentially an MRT within a short walking distance.Contact our Singapore New Launch 2020 as we expect a spectacular launch opening sales for Ki Residences by Hoi Hup