Saturday, December 17, 2022

vnc Raspbian

 para instalar VNC en raspbian 

sudo apt-get install realvnc-vnc-server


mas info en https://www.realvnc.com/en/blog/how-to-setup-vnc-connect-raspberry-pi/

por el error de no iniciar el escritorio

How to Fix Raspberry Pi's 'Cannot Currently Show the Desktop' Error

https://www.tomshardware.com/how-to/fix-cannot-currently-show-desktop-error-raspberry-pi

Friday, November 18, 2022

Power Shell para revisar rango de IP

Power Shell para revisar rango de IP

 for ($i = 1; $i -lt 255; $i++) {

    Test-Connection "192.168.100.$i" -Count 1 -ErrorAction SilentlyContinue

}

Wednesday, November 9, 2022

Jenkins no se inicia de manera automatica

Error:

Service cannot be started. System.ComponentModel.Win32Exception (0x80004005): The system cannot find the file specified

   at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)

   at winsw.Util.ProcessHelper.StartProcessAndCallbackForExit(Process processToStart, String executable, String arguments, Dictionary`2 envVars, String workingDirectory, Nullable`1 priority, ProcessCompletionCallback callback, Boolean redirectStdin, LogHandler logHandler, Boolean hideWindow)

   at winsw.WrapperService.StartProcess(Process processToStart, String arguments, String executable, LogHandler logHandler, Boolean redirectStdin)

   at winsw.WrapperService.OnStart(String[] args)

   at System.ServiceProcess.ServiceBase.ServiceQueuedMainCallback(Object state) 


https://serverfault.com/questions/1039864/jenkins-fails-to-start-on-windows-server-after-java-runtime-update-uninstalled-o


D:\Services\Jenkins\jenkins.xml


el error lo da el ejecutable 

<executable>C:\Program Files (x86)\Java\jre1.8.0_341\\bin\java.exe</executable>


el motivo es que se actualizo la version de java y esto no es detectado por jenkins.

Thursday, October 13, 2022

Sitios utiles

Sitios utiles

https://haveibeenpwned.com/ - para ver tu correo personal o corporativo

https://cybernews.com/password-leak-check/ - para ver si las claves mas usadas que tienes han sido filtradas.

Saturday, September 3, 2022

Comandos de red utiles

 

sudo arp-scan --localnet                 para saber que hay en la red

sudo netdiscover -r 192.168.1.0/24 para saber que hay en la red

Enum4linux                 conocer usuarios de la red

nmblookup -A IP         para saber nombre de la maquina


NMAP                  scan de puertos
nmap -sS 192.168.0.1 validacion de servicios TCP
nmap -sT 192.168.0.1 validacion de servicios UDP
nmap -sV 192.168.0.1 validacion de version del servicio
nmap -sC -A -p23,80,443,5000 192.168.0.1 revision de puertos especificos
nmap 192.168.0.5,233,252 o rangos: nmap 192.168.0.200-254 para scan de rangos de IP

configurar timezone linux ubuntu - set TimeZone

#configurar timezone linux ubuntu  - set TimeZone

sudo timedatectl set-timezone America/Santiago

Tuesday, August 30, 2022

Audit a las autenticaciones

con estos comandos podemos visualizar que usuarios han intentado ingresar a la maquina

#funciona hast debian buster

cat /var/log/auth* | grep Failed


cat /var/log/auth* | grep Accepted

audit.sh


Para bookworm Debian 12

#https://serverfault.com/questions/1148725/where-is-some-os-logs-in-debian-12

journalctl --since "1 hour ago" | grep Accepted*

journalctl --since "1 hour ago" | grep Failed*


Ejemplo:  sshd[178606]: Accepted password for pi from 192.168.1.105 port 58964 ssh2



Saturday, July 9, 2022

correo plano python - Sending Emails in Python With SMTP

 https://code.tutsplus.com/tutorials/sending-emails-in-python-with-smtp--cms-29975

# import necessary packages

  

from email.mime.multipart import MIMEMultipart

from email.mime.text import MIMEText

import smtplib

  

# create message object instance

msg = MIMEMultipart()

  

  

message = "Thank you"

  

# setup the parameters of the message

password = "your_password"

msg['From'] = "your_address"

msg['To'] = "to_address"

msg['Subject'] = "Subscription"

  

# add in the message body

msg.attach(MIMEText(message, 'plain'))

  

#create server

server = smtplib.SMTP('smtp.gmail.com: 587')

  

server.starttls()

  

# Login Credentials for sending the mail

server.login(msg['From'], password)

  

  

# send the message via the server.

server.sendmail(msg['From'], msg['To'], msg.as_string())

  

server.quit()

  

print("successfully sent email to %s:" % (msg['To']))

Temp - stress rpi4 fanless

 https://community.element14.com/products/roadtest/b/blog/posts/raspberry-pi-4-model-b-review

sudo apt-get install stress

sudo stress --cpu 4

watch -n 1 /opt/vc/bin/vcgencmd measure_temp

Thursday, June 30, 2022

Clear Jenkins build history ( clear build yesterday )

Go to Jenkins Script Console.

Go to your Jenkins home page -> Manage Jenkins -> Script Console.

def jobName = "Nombre del job a limpiar"

def job = Jenkins.instance.getItem(jobName)  

job.getBuilds().each { it.delete() }  

job.nextBuildNumber = 1   

job.save()


https://superuser.com/questions/1418885/clear-jenkins-build-history-clear-build-yesterday#:~:text=Delete%20a%20Jenkins%20build%20via,script%20in%20Jenkins%20Script%20Console.

Tuesday, May 31, 2022

memoria disponible en servidor SQL

 SELECT

(total_physical_memory_kb/1024) AS Total_OS_Memory_MB,

(available_physical_memory_kb/1024)  AS Available_OS_Memory_MB

FROM sys.dm_os_sys_memory;


SELECT  

(physical_memory_in_use_kb/1024) AS Memory_used_by_Sqlserver_MB,  

(locked_page_allocations_kb/1024) AS Locked_pages_used_by_Sqlserver_MB,  

(total_virtual_address_space_kb/1024) AS Total_VAS_in_MB,

process_physical_memory_low,  

process_virtual_memory_low  

FROM sys.dm_os_process_memory; 


select getdate() as fecha_y_Hora_Actual


salida.







System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a send

Solucion - forzar TLS 1.2

 var securityProtocol = (int)System.Net.ServicePointManager.SecurityProtocol;

                // 0 = SystemDefault in .NET 4.7+

                if (securityProtocol != 0)

                {

                    Log.Info(securityProtocol);

                    System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12;

                    Log.Info("allocated Security Protocal: " + ServicePointManager.SecurityProtocol);

                }


System.AggregateException: One or more errors occurred. ---> System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a send. ---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host

   at System.Net.Sockets.Socket.EndReceive(IAsyncResult asyncResult)

   at System.Net.Sockets.NetworkStream.EndRead(IAsyncResult asyncResult)

   --- End of inner exception stack trace ---

   at System.Net.TlsStream.EndWrite(IAsyncResult asyncResult)

   at System.Net.PooledStream.EndWrite(IAsyncResult asyncResult)

   at System.Net.ConnectStream.WriteHeadersCallback(IAsyncResult ar)

   --- End of inner exception stack trace ---

   at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)

   at System.Net.Http.HttpClientHandler.GetResponseCallback(IAsyncResult ar)

   --- End of inner exception stack trace ---

   --- End of inner exception stack trace ---

   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)

   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)

   at System.Threading.Tasks.Task`1.get_Result()



System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a send. ---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host

   at System.Net.Sockets.Socket.EndReceive(IAsyncResult asyncResult)

   at System.Net.Sockets.NetworkStream.EndRead(IAsyncResult asyncResult)

   --- End of inner exception stack trace ---

   at System.Net.TlsStream.EndWrite(IAsyncResult asyncResult)

   at System.Net.PooledStream.EndWrite(IAsyncResult asyncResult)

   at System.Net.ConnectStream.WriteHeadersCallback(IAsyncResult ar)

   --- End of inner exception stack trace ---

   at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)

   at System.Net.Http.HttpClientHandler.GetResponseCallback(IAsyncResult ar)

   --- End of inner exception stack trace ---<---

Sunday, May 8, 2022

RAM zram-tools

 

#basado en https://www.muylinux.com/2021/01/29/swap-zram-debian-ubuntu/

sudo apt install zram-tools

sudo nano /etc/default/zramswap

PERCENTAGE=50


#borrar la particion de swap

sudo nano /etc/fstab 

#para desactivar la particion de swap

sudo dphys-swapfile swapoff


The following packages have unmet dependencies

 The following packages have unmet dependencies:

 vlc-bin : Depends: libvlc-bin (= 3.0.12-0+deb10u1+rpt1+arm64) but 3.0.12-0+deb10u1+rpt3 is to be installed

 vlc-plugin-skins2 : Depends: vlc-plugin-qt (= 3.0.12-0+deb10u1+rpt3) but 3.0.12-0+deb10u1+rpt1+arm64 is to be installed

E: Broken packages


#se resuelve con 

#sudo apt update && sudo apt full-upgrade -y 

sudo apt update

sudo apt full-upgrade



Thursday, May 5, 2022

Count IP address in Nginx access logs

basado en  https://mkyong.com/nginx/count-ip-address-in-nginx-access-logs/

 sudo awk '{print $1}' /var/log/nginx/access.log | sort | uniq -c | sort -nr


map IP 

https://ipinfo.io/tools/map


https://ipinfo.io/tools/map/f7bafa18-f694-46f6-8240-f94b90c70332

Sunday, May 1, 2022

reducir consumo ram en google chrome

 

https://www.adslzone.net/como-se-hace/chrome/reducir-consumo-ram/

chrome://settings/cleanup

desactivar chrome en segundo plano

Desactivar Chrome en segundo plano

En el momento que cerramos el navegador se cierran todas las pestañas abiertas en esa ventana, sin embargo, hay ciertos procesos que se pueden quedar ejecutándose en segundo plano y que se corresponden con determinadas aplicaciones que pueden depender del propio navegador y que por lo tanto, seguirán consumiendo ciertos recursos del equipo.

Para evitar esto, abrimos una ventana del navegador, hacemos clic en el botón de menú (tres puntos en vertical), entramos en la Configuración. Una vez ahí, nos desplazamos hacia abajo por los diferentes ajustes, desplegamos la configuración avanzada y buscamos la sección Sistema.


Desactivar el envío de errores

Aunque lo cierto es una característica que no llega a consumir gran cantidad de memoria, un poco de allí y un poco de allá siempre ayudará a conseguir una mejor experiencia y rendimiento. En esta ocasión nos referimos a la opción de desactivar el envío de informes de errores en el navegador.

Cuando instalamos Chrome en nuestro equipo se nos avisa de que se van realizarán ciertos envíos de informes anónimos de cualquier error que se pueda producir. La verdad es que es algo que la mayoría de usuarios no suele fijarse, pero por suerte podemos desactivarlo en cualquier momento. Para ello, debemos abrir una ventana del navegador, pulsar sobre el botón de menú para entrar en la configuración y una vez ahí, dentro de la primera sección Google y tú hacemos clic sobre la opción Sincronización y servicios de Google.





Saturday, January 22, 2022

Default scan nitko Kali linux

  nikto -h 192.168.1.216 -p 80

- Nikto v2.1.6

---------------------------------------------------------------------------

+ Target IP:          192.168.1.216

+ Target Hostname:    192.168.1.216

+ Target Port:        80

+ Start Time:         2022-01-22 23:45:30 (GMT0)

---------------------------------------------------------------------------

+ Server: Apache/2.4.41 (Ubuntu)

+ The anti-clickjacking X-Frame-Options header is not present.

+ The X-XSS-Protection header is not defined. This header can hint to the user agent to protect against some forms of XSS

+ The X-Content-Type-Options header is not set. This could allow the user agent to render the content of the site in a different fashion to the MIME type

+ No CGI Directories found (use '-C all' to force check all possible dirs)

+ Server may leak inodes via ETags, header found with file /, inode: 2aa6, size: 5d634201ca691, mtime: gzip

+ Allowed HTTP Methods: HEAD, GET, POST, OPTIONS

+ /info.php: Output from the phpinfo() function was found.

+ OSVDB-3233: /info.php: PHP is installed, and a test script which runs phpinfo() was found. This gives a lot of system information.

+ OSVDB-5292: /info.php?file=http://cirt.net/rfiinc.txt?: RFI from RSnake's list (http://ha.ckers.org/weird/rfi-locations.dat) or from http://osvdb.org/


+ 7915 requests: 0 error(s) and 8 item(s) reported on remote host

+ End Time:           2022-01-22 23:48:25 (GMT0) (175 seconds)

---------------------------------------------------------------------------

+ 1 host(s) tested


Thursday, January 13, 2022

Agregar la fecha por consola

Agregar la fecha por consola

para mostrar actual fecha y hora

date

sudo hwclock --show


sudo date --set="2022-01-13 08:23:59.990"


by

https://askubuntu.com/questions/679988/how-to-change-ubuntus-server-date-and-time-via-command-line 

Thursday, January 6, 2022

Detalle de espacio utilizado por las bases de datos de un servidor sql server

select 

    d.name as DatabaseName,

    a.name as FileName,

    FG.name as FileGroup,

    a.physical_name as FilePath,

    a.type_desc as FileType,

    CONVERT(DECIMAL(12,2),ROUND(a.size/128.000,2)) AS [Size],

    CONVERT(DECIMAL(12,2),ROUND(FILEPROPERTY(a.name,'SpaceUsed')/128.000,2)) AS [Used] ,

    CONVERT(DECIMAL(12,2),ROUND((a.size-FILEPROPERTY(a.name,'SpaceUsed'))/128.000,2)) AS [Free]

from sys.databases d

left join sys.master_files a on d.database_id = a.database_id

left join sys.filegroups FG on

    FG.data_space_id = a.data_space_id;

Saturday, January 1, 2022

instalar xrdp

#instalar xrdp raspbian

sudo apt update

sudo apt install xrdp


sudo systemctl enable xrdp

sudo systemctl restart xrdp