lunes, 1 de abril de 2024

RF-nano



para controlar un robot

Emisor TX

#include <SPI.h>
#include "Mirf.h"
#include "nRF24L01.h"
#include "MirfHardwareSpiDriver.h"
Nrf24l Mirf = Nrf24l(10, 9);
int value;
int contador=0;
int MOV=1;

void setup()
{
  Serial.begin(9600);
  Mirf.spi = &MirfHardwareSpi;
  Mirf.init();
  //Set your own address (sender address) using 5 characters
  Mirf.setRADDR((byte *)"CONTR");
  Mirf.payload = sizeof(value);
  Mirf.channel = 90;              //Set the channel used
  Mirf.config();
}

void loop()
{
  Mirf.setTADDR((byte *)"ROB01");         //Set the receiver address
  value = MOV;                                //adelante MOV=1
  Mirf.send((byte *)&value);                //Send instructions, send random number value
  while (Mirf.isSending()) delay(1);        //Until you send successfully, exit the loop
  delay(200);
  contador=contador+1;
  if(contador>=50){
    MOV=2;
  }
  if(contador>=100){
    MOV=1;
    contador=0;
  }
}

Receptor RX

//Receiver program
#include <SPI.h>
#include "Mirf.h"
#include "nRF24L01.h"
#include "MirfHardwareSpiDriver.h"
Nrf24l Mirf = Nrf24l(10, 9);

int value;
int mov;
//MOTOR 1
const int mot1_A=6; 
const int mot1_B=5;
//MOTOR 2
const int mot2_A=4;
const int mot2_B=3;
//MOTOR 3
const int mot3_A=14;   //A0
const int mot3_B=15;   //A1
//MOTOR 4
const int mot4_A=16;   //A2
const int mot4_B=17;   //A3

void setup()
{
  Serial.begin(9600);
  Mirf.spi = &MirfHardwareSpi;
  Mirf.init();

  Mirf.setRADDR((byte *)"ROB01"); //Set your own address (receiver address) using 5 characters
  Mirf.payload = sizeof(value);
  Mirf.channel = 90;             //Set the used channel
  Mirf.config();
  Serial.println("Listening...");  //Start listening to received data

  pinMode(mot1_A, OUTPUT);
  pinMode(mot1_B, OUTPUT);
  pinMode(mot2_A, OUTPUT);
  pinMode(mot2_B, OUTPUT);
  pinMode(mot3_A, OUTPUT);
  pinMode(mot3_B, OUTPUT);
  pinMode(mot4_A, OUTPUT);
  pinMode(mot4_B, OUTPUT);
}

void loop()
{
  if (Mirf.dataReady()) { //When the program is received, the received data is output from the serial port
    Mirf.getData((byte *) &value);
    mov=value;
    Serial.println(mov);
    switch (mov) {
    case 1:
      adelante();
      break;
    case 2:
      atras();
      break;
    case 3:
      izquierda();
      break;
    case 4:
      derecha();
      break;
    case 5:
      detenido();
      break;
    default:
      // if nothing else matches, do the default
      // default is optional
      break;
    }
  }
}

void adelante() {
  digitalWrite(mot1_A, HIGH);
  digitalWrite(mot1_B, LOW);
  digitalWrite(mot2_A, HIGH);
  digitalWrite(mot2_B, LOW);
  digitalWrite(mot3_A, HIGH);
  digitalWrite(mot3_B, LOW);
  digitalWrite(mot4_A, HIGH);
  digitalWrite(mot4_B, LOW);
  }
void atras() {
  digitalWrite(mot1_A, LOW);
  digitalWrite(mot1_B, HIGH);
  digitalWrite(mot2_A, LOW);
  digitalWrite(mot2_B, HIGH);
  digitalWrite(mot3_A, LOW);
  digitalWrite(mot3_B, HIGH);
  digitalWrite(mot4_A, LOW);
  digitalWrite(mot4_B, HIGH);
  }
void izquierda() {
  //motor 1 y 3 adelante
  digitalWrite(mot1_A, HIGH);
  digitalWrite(mot1_B, LOW);
  digitalWrite(mot3_A, HIGH);
  digitalWrite(mot3_B, LOW);
  //motor 2 y 4 atras
  digitalWrite(mot2_A, LOW);
  digitalWrite(mot2_B, HIGH);
  digitalWrite(mot4_A, LOW);
  digitalWrite(mot4_B, HIGH);
  }
void derecha() {
  //motor 1 y 3 atras
  digitalWrite(mot1_A, LOW);
  digitalWrite(mot1_B, HIGH);
  digitalWrite(mot3_A, LOW);
  digitalWrite(mot3_B, HIGH);
  //motor 2 y 4 adelante
  digitalWrite(mot2_A, HIGH);
  digitalWrite(mot2_B, LOW);
  digitalWrite(mot4_A, HIGH);
  digitalWrite(mot4_B, LOW);
  }
void detenido() {
  digitalWrite(mot1_A, LOW);
  digitalWrite(mot1_B, LOW);
  digitalWrite(mot2_A, LOW);
  digitalWrite(mot2_B, LOW);
  digitalWrite(mot3_A, LOW);
  digitalWrite(mot3_B, LOW);
  digitalWrite(mot4_A, LOW);
  digitalWrite(mot4_B, LOW);
  }

Robot

ffdsa fdsa fds  dfdafds

miércoles, 21 de febrero de 2024

todo de docker rapido


Instalar

https://www.youtube.com/watch?v=ZO4KWQfUBBc


BUSCAR imagen

en cmd buscar contenedores

o en por web en docker hub   https://hub.docker.com/

DESCARGAR imagen en este caso Ubuntu, solo el comando: 

docker pull ubuntu



BUILD a una imagen ya descargada con docker, creando de esta manera el contenedor

docker run -it ubuntu:latest /bin/bash


es necesario actualizar dependencias para no tener errores en el contenedor docker ubuntu

apt-get update

apt-get upgrade 


instalando algunos programas útiles

apt-get install net-tools

apt-get install -y build-essential

apt-get install -y software-properties-common

add-apt-repository ppa:deadsnakes/ppa

apt-get update

apt-get install python3

 apt-get install python3-pip

ln -s /usr/bin/python3 /usr/bin/python


salir del contenedor ya coriendo bash

exit


VOLVER a entrar al contenedor del cual salimos que esta en suspension, con la misma sesion


comandos


docker ps -a

docker start 4bca06dc3530

docker exec -it gracious_stonebraker bash


OJO

tener en cuenta que descargar imagen no es tener el contenedor. Al ejecutar RUN creamos el contenedor para ver contenedores ACTIVOS:

docker ps

para ver todos los contenedores ACTIVOS e INACTIVOS: 

docker ps -a

para detener un CONTENEDOR activo:

docker stop 3db75215661 (id del contenedor activo)

para  arrancar un CONTENEDOR detenido:

docker start 3db75215661 (id del contenedor inactivo)


docker sobre linux ver rapidamente este video https://www.youtube.com/watch?v=_0EYw9PGMnM 



domingo, 28 de enero de 2024

cursos recomendados

 

courses & resources

topicformatdifficultyrelease yearpricecourse
Generative AIGitHub repository🟩⬜⬜2023freeGenerative AI for Beginners by Microsoft
Deep LearningYouTube playlist🟩🟩⬜2023free6.5940 TinyML and Efficient Deep Learning Computing by Massachusetts Institute of Technology
Natural Language ProcessingYouTube playlist🟩🟩⬜2023freeNatural Language Processing by The University of Texas at Austin
Deep Learningwebsite🟩⬜⬜2023freeDeep Learning Fundamentals - Learning Deep Learning Using a Modern Open-Source Stack by Sebastian Raschka
Large Language ModelsYouTube playlist🟩🟩⬜2023freeLLM Bootcamp - Spring 2023 by The Full Stack
PythonYouTube playlist🟩⬜⬜2023freeCS50: Introduction to Programming with Python by Harvard University x freeCodeCamp.org
Stable Diffusion and Deep Learningwebsite🟩🟩⬜2023freePractical Deep Learning for Coders part 2: Deep Learning Foundations to Stable Diffusion by fast.ai
Deep LearningYouTube playlist🟩⬜⬜2023free6.S191: Introduction to Deep Learning by Massachusetts Institute of Technology
Deep LearningYouTube playlist🟩⬜⬜2023freeNeural Networks: Zero to Hero by Andrej Karpathy
Large Language Models and Prompt Engineeringwebsite🟩⬜⬜2023freePrompt Engineering Guide by DAIR.AI
Computer VisionYouTube playlist🟩⬜⬜2023freeComputer Vision in Practice by Piotr Skalski x Roboflow
Natural Language ProcessingYouTube playlist🟩🟩⬜2023freeCS685: Advanced Natural Language Processing by University of Massachusetts
Machine LearningYouTube playlist🟩🟩⬜2022freeCS229: Machine Learning by Stanford University
MLOpsYouTube playlist🟩🟩⬜2022freeMachine Learning Engineering for Production by Andrew Y. Ng
Multimodal Machine LearningYouTube playlist🟩🟩🟩2022free11-777: Multimodal Machine Learning by Carnegie Mellon University
Deep Multi-Task and Meta LearningYouTube playlist🟩🟩🟩2022freeCS330 Deep Multi-Task and Meta Learning by Stanford University
Deep LearningYouTube playlist🟩⬜⬜2022freePractical Deep Learning for Coders by fast.ai
Natural Language ProcessingYouTube playlist🟩🟩⬜2021freeCS224U: Natural Language Understanding by Stanford University
TransformersYouTube playlist🟩🟩🟩2021freeCS25: Transformers United by Stanford University
Deep LearningYouTube playlist🟩🟩⬜2021freeNYU-DLSP21: NYU Deep Learning Spring by New York University
Natural Language Processing and Transformerswebsite🟩⬜⬜2021freeNLP Course by Hugging Face
Deep Learningbook🟩⬜⬜2021freeDive into Deep Learning by d2l.ai
Reinforcement LearningYouTube playlist🟩🟩🟩2021freeReinforcement Learning Course by DeepMind x University College London
Natural Language ProcessingYouTube playlist🟩🟩⬜2021freeCS224N: Natural Language Processing with Deep Learning by Stanford University
Deep LearningYouTube playlist🟩🟩⬜2020freeDeep Learning Lecture Series by DeepMind x University College London
Linear Algebrawebsite🟩🟩🟩2019freeAdvanced Linear Algebra - Foundations to Frontiers by Margaret E. Myers & Robert A. van de Geijn
Artificial IntelligenceYoutube playlist🟩🟩⬜2019freeStanford CS221: Artificial Intelligence: Principles and Techniques by Stanford University
Computer VisionYoutube playlist🟩🟩⬜2019freeUniversity of Michigan EECS 498.008 / 598.008: Deep Learning for Computer Vision by University of Michigan
Computer VisionYouTube playlist🟩🟩⬜2018freeCS231n: Deep Learning for Computer Vision by Stanford University
Statistics and ProbabilityYouTube playlist🟩⬜⬜2013freeStatistics 110: Probability by Harvard University

viernes, 26 de enero de 2024

google gorks (pero con D)

 Dorks

Collection of Most Useful Google Dorks

Google DorkUsed forExample
"specified_phrase or statement"shows only those pages that contains exact word or statement"Is hacking illegal"
site:removes search results from all other websites except the mentioned onesite:amazon.com smartwatches
inurl:specified_phraseshows only those search results which contains the specified word in urlinurl:ethical hacking
inurl:word1 word2shows search results that contain either of the word or bothinurl:hacking programming
allinurl:word1 word2shows the search results that contain both of the wordsallinurl:hacking programming
intitle:word1 word2shows those search results that mention word in their title and mention the word “word” anywhere in the documentintitle:hacking networking
cache:shows the website homepage even if website is downcache:netflix.com
intext:word1shows only those pages containing that specific word (or words) somewhere in the contextintext:bug hunting
allintext:word1 word2only shows pages containing those words somewhere in the contextallintext:hacking networking
intitle:”index of”shows open ftp serversintitle:”index of spiderman movie”
inurl:view/index.shtmlshows live cameras that don’t have any protectioninurl:view/index.shtml
filetype:pdf/doc/ppt specified_phraseshows only pages that contains the document of that type and contains specific word in file namefiletype:pdf ethical hacking
+shows only those pages that must contain that specific wordethical hacking + free course
-avoid showing results that contain certain wordsethical hacking - paid course

Special Collection for Cybersecurity Learners

Google DorkUsed for
intitle:”index of”shows open ftp servers
cache:shows the website homepage even if website is down
inurl:view/index.shtmlshows live cameras that don’t have any protection
login: passwordfiletype:xlsshows password list of some random websites
allintext:username filetype:logshows log files of random websites
inurl:/proc/self/cwdused to detect vulnerable or hacked servers
intitle:"index of" inurl:ftpshows open ftp servers
filetype:xls inurl:"email.xls"used to find database of emails
intitle:"Index of" wp-adminused to find wordpress login page of random websites


Special Collection for Sql Injection

Nice list of google dorks for SQL injection





miércoles, 3 de enero de 2024

wifi scan

 Escaneando redes wifi con esp32, programando en el IDE de arduino


#include "WiFi.h"


void setup()

{

    Serial.begin(115200);


    // Set WiFi to station mode and disconnect from an AP if it was previously connected.

    WiFi.mode(WIFI_STA);

    WiFi.disconnect();

    delay(100);


    Serial.println("Setup done");

}


void loop()

{

    Serial.println("Scan start");


    // WiFi.scanNetworks will return the number of networks found.

    int n = WiFi.scanNetworks();

    Serial.println("Scan done");

    if (n == 0) {

        Serial.println("no networks found");

    } else {

        Serial.print(n);

        Serial.println(" networks found");

        Serial.println("Nr | SSID                             | RSSI | CH | Encryption");

        for (int i = 0; i < n; ++i) {

            // Print SSID and RSSI for each network found

            Serial.printf("%2d",i + 1);

            Serial.print(" | ");

            Serial.printf("%-32.32s", WiFi.SSID(i).c_str());

            Serial.print(" | ");

            Serial.printf("%4d", WiFi.RSSI(i));

            Serial.print(" | ");

            Serial.printf("%2d", WiFi.channel(i));

            Serial.print(" | ");

            switch (WiFi.encryptionType(i))

            {

            case WIFI_AUTH_OPEN:

                Serial.print("open");

                break;

            case WIFI_AUTH_WEP:

                Serial.print("WEP");

                break;

            case WIFI_AUTH_WPA_PSK:

                Serial.print("WPA");

                break;

            case WIFI_AUTH_WPA2_PSK:

                Serial.print("WPA2");

                break;

            case WIFI_AUTH_WPA_WPA2_PSK:

                Serial.print("WPA+WPA2");

                break;

            case WIFI_AUTH_WPA2_ENTERPRISE:

                Serial.print("WPA2-EAP");

                break;

            case WIFI_AUTH_WPA3_PSK:

                Serial.print("WPA3");

                break;

            case WIFI_AUTH_WPA2_WPA3_PSK:

                Serial.print("WPA2+WPA3");

                break;

            case WIFI_AUTH_WAPI_PSK:

                Serial.print("WAPI");

                break;

            default:

                Serial.print("unknown");

            }

            Serial.println();

            delay(10);

        }

    }

    Serial.println("");


    // Delete the scan result to free memory for code below.

    WiFi.scanDelete();


    // Wait a bit before scanning again.

    delay(1000);

}


quitando la encriptación y añadiendo el BSSID


#include "WiFi.h"


void setup()

{

    Serial.begin(115200);


    // Set WiFi to station mode and disconnect from an AP if it was previously connected.

    WiFi.mode(WIFI_STA);

    WiFi.disconnect();

    delay(100);


    Serial.println("Setup done");

}


void loop()

{

    Serial.println("Scan start");


    // WiFi.scanNetworks will return the number of networks found.

    int n = WiFi.scanNetworks();

    Serial.println("Scan done");

    if (n == 0) {

        Serial.println("no networks found");

    } else {

        Serial.print(n);

        Serial.println(" networks found");

        Serial.println("Nr | SSID                             | RSSI | CH | BSSID (MAC)");

        for (int i = 0; i < n; ++i) {

            // Print SSID and RSSI for each network found

            Serial.printf("%2d",i + 1);

            Serial.print(" | ");

            Serial.printf("%-32.32s", WiFi.SSID(i).c_str());

            Serial.print(" | ");

            Serial.printf("%4d", WiFi.RSSI(i));

            Serial.print(" | ");

            Serial.printf("%2d", WiFi.channel(i));

            Serial.print(" | ");

            Serial.print(WiFi.BSSIDstr(i));

            Serial.println();

            delay(10);

        }

    }

    Serial.println("");


    // Delete the scan result to free memory for code below.

    WiFi.scanDelete();


    // Wait a bit before scanning again.

    delay(1000);

}


relacione  BSSID y MAC


que es el bssid aquí 


esp-idf


Como programar con la herramienta nativa de ESP32

Entorno de programación: tengo varias versiones instalado en la PC no obstante recomiendo la 4.4 


Comandos: detallado a continuación 

- Para crear el sdkconfig, Realizar si o si este comando por mas que no se configure nada en las opciones que se observa en la imagen que se observa a continuacion

idf.py menuconfig


- Para construir el programa después de haber hecho, y corregido el programa: en mi caso utilizo el notepad++ 

idf.py build


- Para grabar en el esp32: para cargar el programa (si no tubiera errores)

idf.py -p (PORT) flash 

donde (PORT) ver en administrador de dispositivos que puerto COM se designo al ESP32 despues de haberlo conectado a la PC

- para abrir el monitor serial desde el ESP-IDF (también puede utilizar cualquier otro monitor serial)

idf.py -p (PORT) monitor


Con eso ya estaría todo el entorno de subir un programa al ESP32  utilizando ESP-IDF 4.4



sábado, 30 de septiembre de 2023

Usando threading para la lectura de puertos seriales Raspberry Pi 3

la manera mas rápida es utilizando "PyMultiSerial Python Module", 

https://www.instructables.com/How-to-Monitor-Arduinos-Connected-to-Multiple-Port/



no obstante no te otorga la flexibilidad que brinda pyserial

en el siguiente hilo se muestra la manera de realizar threading para solucionar el problema de lectura de datos de 2 puertos seriales:
https://stackoverflow.com/questions/38861980/attempting-to-read-from-two-serial-ports-at-once