b0sh.net

Proudly debugging the system since 1981

Pagina 10 di 124

Correre o non correre

In tempo di NON coprifuoco, con l’Italia NON chiusa ma caldamente invitata ad essere più asociale che mai la corsa, sport solitario che si può praticare in gruppi grandi a piacere, si adattata molto bene.

Quindi si ho deciso che sì: potevo correre, da solo, in periferia, girando molto al largo da sparuti passanti pur rispettando l’essenza di quello che ci viene chiesto di fare e non causando pericolo ne a me ne agli altri.

Lo rifarò a breve.

Perchè?

Contesto: classe Java, framework Wicket (ma non è significativo), IDE Intellij.

Quale sarà mai il motivo percui, un anonimo programmatore che mi ha preceduto, può aver pensato che avesse senso fare un metodo privato, che nel nome richiama l’idea di un factory method, che ritorna un campo della sua stessa classe?

E poi perchè commentarlo con // (5) ?

Continua a leggere

Cialtrone

cialtróne s. m. (f. -a) [etimo incerto]. – Persona volgare e spregevole, arrogante e poco seria, trasandata nell’operare, priva di serietà e correttezza nei rapporti personali, o che manca di parola nei rapporti di lavoro. Anche, con sign. attenuato, persona sciatta nel vestire e nel portamento, o che nel lavoro sia solita fare le cose in fretta e senza attenzione.

http://www.treccani.it/vocabolario/cialtrone

Cambio di server

Il mio hoster (OVH) una decina di giorni fà ha deciso unilateralmente di spegnermi il VPS. Certo non subito, ma non è stata certo una cosa gradita. Utilizzavo da tempo il pacchetto “VPS Classic 2014” che hanno deciso di dismettere. Il nome in effetti non fa intendere che sia un offerta all’ultima moda. Ma ci avevo perso un bel pò di tempo a configurarmelo a mio piacere, come si può leggere sotto a partire da questo articolo e successivi seguendo il tag VPS.

Dopo quasi 5 anni devo dire che la configurazione si è rivelata efficace e non mi ha mai dato particolari noie. Solo qualche update ogni tanto dei pacchetti.

Ora però non avevo voglia di rifare tutto da capo, la macchina non era clonabile sulla nuova piattaforma e cosi mi son fatto tentare da un configurazione pronta con pannello amministrativo, virtualmin, che devo dire ha reso la migrazione facile e veloce. Ed ha praticamente tutto. Vedremo se durerà altrettanto.

L’unica cosa che non ho riconfigurato è una vpn, ma ci sarà sicuramente da qualche parte un plugin. Seguirà post se ne vale la pena.

AutoVer

AutoVer is a configurable automatic or real time backup and personal versioning system. It can be used as a simple real time backup or as a more complex, but transparent version control system (like a realtime incremental backup). The beauty of this system is that once you set it up (which is extremely simple) it does everything. No remembering to backup or to check in or check out files. Every time you save a file it is copied to your backup folder, drive or FTP server. You can include and exclude certain files and browse the backups with the Backup Explorer.
Great for backing up (or one way synchronising) your work or home documents to flash memory or saving every change you make to your source code or image files.

http://beanland.net.au/autover/

alibaba/Sentinel

A lightweight powerful flow control component enabling reliability and monitoring for microservices. (????????????? Java ?) – alibaba/Sentinel

As distributed systems become increasingly popular, the reliability between services is becoming more important than ever before. Sentinel takes “flow” as breakthrough point, and works on multiple fields including flow control, circuit breaking and system adaptive protection, to guarantee reliability of microservices.

Sentinel has the following features:

  • Rich applicable scenarios: Sentinel has been wildly used in Alibaba, and has covered almost all the core-scenarios in Double-11 (11.11) Shopping Festivals in the past 10 years, such as “Second Kill” which needs to limit burst flow traffic to meet the system capacity, message peak clipping and valley fills, circuit breaking for unreliable downstream services, cluster flow control, etc. […]

Sorgente: alibaba/Sentinel

Hacking YI Dome / YI Home Ip camera – 4° Puntata

Diversamente da quanto detto nella puntata precedente mi sono concentrato sul verificare l’algoritmo di codifica della password, realizzando un programmino allo scopo:

package net.b0sh.yiCameraClient.test;

import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import java.security.InvalidKeyException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Base64;

public class EncryptionTest {

    public static void main(String[] params) {

        String toBoFound = "OMESSO";
        String cleanPassword = "OMESSO";
        byte[] secret = "secret".getBytes();

        if (digest(cleanPassword, "SHA-256").equals(toBoFound)) {
            System.out.println("success");
        }
        if (digest(cleanPassword, "SHA-1").equals(toBoFound)) {
            System.out.println("success");
        }
        if (digest(cleanPassword, "MD5").equals(toBoFound)) {
            System.out.println("success");
        }
        if (hmac(cleanPassword,"HmacSHA256",secret).equals(toBoFound)) {
            System.out.println("success");
        }
    }

    private static String digest(String password, String alg) {
        try {
            MessageDigest md = MessageDigest.getInstance(alg);
            byte[] bytes = md.digest(password.getBytes());

            System.out.println(alg + " Bytes " + new String(bytes));

            System.out.println(alg + " Base64 " + new String(Base64.getEncoder().encode(bytes)));

            return new String(Base64.getEncoder().encode(bytes));

        } catch (NoSuchAlgorithmException e) {
            System.out.println("NoSuchAlgorithmException");
            return "";
        }
    }

    private static String hmac(String password, String alg, byte[] secret) {

        try {
            SecretKeySpec keySpec = new SecretKeySpec(secret, alg);
            Mac mac = Mac.getInstance(alg);
            mac.init(keySpec);
            mac.update(password.getBytes());

            byte[] bytes = mac.doFinal();


            System.out.println(alg + " Bytes " + new String(bytes));

            System.out.println(alg + " Base64 " + new String(Base64.getEncoder().encode(bytes)));

            return new String(Base64.getEncoder().encode(bytes));

        } catch (NoSuchAlgorithmException e) {
            return "";
        } catch (InvalidKeyException i) {
            return "";
        }

    }

}

Avendo definitiva conferma che l’algoritmo utilizzato è HMAC SHA256, quindi un hash “salato” con un segreto. Il problema quindi resta individuare il segreto. HashCat pare supportare il bruteforce del sale dell’HmacSHA256. Qualcuno ha qualche PetaFLOP da prestarmi?

« Articoli meno recenti Articoli più recenti »

© 2025 b0sh.net

Tema di Anders NorenSu ↑