Showing posts with label Kali. Show all posts
Showing posts with label Kali. Show all posts

Friday, May 5, 2023

Zoneminder on Eeepc i386 kali-2023.1

Eeepc hotel room monitoring works with these settings still:

https://digitalsatori2015.blogspot.com/2016/07/zoneminder-on-1001x-eepc.html

5fps is a bit much for the eepc so set it to 2.  model name      : Intel(R) Atom(TM) CPU N455   @ 1.66GHz

Doesn't work with selinux enabled.  Disabled auditd for speed.

Works with  same GUI settings from before in earlier blog post.

HOWEVER sometimes image is very dim now.  Setting to capture more than 1 frame at a time seems to help but problem keeps coming back.  Goes away for awhile after changing frame settings.

└─# lsb_release -a   

No LSB modules are available.

Distributor ID: Kali

Description:    Kali GNU/Linux Rolling

Release:        2023.1

Codename:       kali-rolling

└─# uname -a
Linux node17 6.1.0-kali7-686-pae #1 SMP PREEMPT_DYNAMIC Debian 6.1.20-2kali1 (2023-04-18) i686 GNU/Linux

└─# /etc/init.d/zoneminder status

● zoneminder.service - ZoneMinder CCTV recording and surveillance system

     Loaded: loaded (/lib/systemd/system/zoneminder.service; enabled; preset: disabled)

     Active: active (running) since Fri 2023-05-05 13:51:01 PDT; 3h 24min ago

       Docs: http://zoneminder.readthedocs.org/en/latest/

   Main PID: 2819 (zmdc.pl)

      Tasks: 11 (limit: 4650)

     Memory: 866.9M

        CPU: 17min 53.616s

     CGroup: /system.slice/zoneminder.service

             ├─2819 /usr/bin/perl -wT /usr/bin/zmdc.pl startup

             ├─2852 /usr/bin/perl -wT /usr/bin/zmfilter.pl --filter_id=1 --daemon

             ├─2856 /usr/bin/perl -wT /usr/bin/zmfilter.pl --filter_id=2 --daemon

             ├─2859 /usr/bin/perl -wT /usr/bin/zmwatch.pl

             ├─2865 /usr/bin/perl -wT /usr/bin/zmtelemetry.pl

             ├─2869 /usr/bin/perl -wT /usr/bin/zmstats.pl

             └─3427 /usr/bin/zmc -d /dev/video0


May 05 13:50:55 node17 zmc_dvideo0[2846]: ERR [zmc_dvideo0] [Failed to set video standard 45056: 25 Inappropriate ioctl for device]

May 05 13:51:01 node17 systemd[1]: Started zoneminder.service - ZoneMinder CCTV recording and surveillance system.

May 05 13:51:09 node17 zmtelemetry[2865]: WAR [Telemetry server returned HTTP POST error code: 301]

May 05 14:34:41 node17 zmc_dvideo0[2846]: ERR [zmc_dvideo0] [Failed to stop capture stream: Bad file descriptor]

May 05 14:34:41 node17 zmc_dvideo0[2846]: ERR [zmc_dvideo0] [Failed to stop capture stream: Bad file descriptor]

May 05 14:34:41 node17 zmwatch[2859]: ERR [Memory map file '/dev/shm/zm.mmap.1' does not exist in zmMemAttach.  zmc might…running.]

May 05 14:34:47 node17 zmc_dvideo0[3383]: ERR [zmc_dvideo0] [Failed to set video standard 45056: 25 Inappropriate ioctl for device]

May 05 14:35:45 node17 zmc_dvideo0[3383]: ERR [zmc_dvideo0] [Failed to stop capture stream: Bad file descriptor]

May 05 14:35:45 node17 zmc_dvideo0[3383]: ERR [zmc_dvideo0] [Failed to stop capture stream: Bad file descriptor]

May 05 14:35:47 node17 zmc_dvideo0[3427]: ERR [zmc_dvideo0] [Failed to set video standard 45056: 25 Inappropriate ioctl for device]

Hint: Some lines were ellipsized, use -l to show in full.

# zmu -d /dev/video0 -q -v
05/05/23 17:21:28.785100 zmu[5103].ERR-zm_local_camera.cpp/1551 [Failed to set video input 0: Device or resource busy]

Video Device: /dev/video0
General Capabilities
  Driver: uvcvideo
  Card: USB 2.0 Camera: USB Camera
  Bus: usb-0000:00:1d.7-6
  Version: 6.1.20
  Type: 0x84a00001
    Supports video capture (X)
    Does not support video output
    Does not support frame buffer overlay
    Does not support VBI capture
    Does not support VBI output
    Does not support sliced VBI capture
    Does not support sliced VBI output
    Does not support video output overlay
    Does not have tuner
    Does not have audio in and/or out
    Does not have radio
    Does not support read/write i/o (X)
    Does not support async i/o
    Supports streaming i/o (X)
    Standards:
  Formats:
  YUYV 4:2:2 (0x56595559)
Crop Capabilities
  Cropping is not supported
Inputs: 1
Error, failed to switch to input 0: Device or resource busy

 v4l2-ctl --all 
Driver Info:
Driver name      : uvcvideo
Card type        : USB 2.0 Camera: USB Camera
Bus info         : usb-0000:00:1d.7-6
Driver version   : 6.1.20
Capabilities     : 0x84a00001
Video Capture
Metadata Capture
Streaming
Extended Pix Format
Device Capabilities
Device Caps      : 0x04200001
Video Capture
Streaming
Extended Pix Format
Media Driver Info:
Driver name      : uvcvideo
Model            : USB 2.0 Camera: USB Camera
Serial           : SN0001
Bus info         : usb-0000:00:1d.7-6
Media version    : 6.1.20
Hardware revision: 0x00000528 (1320)
Driver version   : 6.1.20
Interface Info:
ID               : 0x03000002
Type             : V4L Video
Entity Info:
ID               : 0x00000001 (1)
Name             : USB 2.0 Camera: USB Camera
Function         : V4L2 I/O
Flags            : default
Pad 0x01000007   : 0: Sink
  Link 0x02000013: from remote pad 0x100000a of entity 'Extension 5' (Video Pixel Formatter): Data, Enabled, Immutable
Priority: 2
Video input : 0 (Input 1: ok)
Format Video Capture:
Width/Height      : 640/480
Pixel Format      : 'YUYV' (YUYV 4:2:2)
Field             : None
Bytes per Line    : 1280
Size Image        : 614400
Colorspace        : sRGB
Transfer Function : Rec. 709
YCbCr/HSV Encoding: ITU-R 601
Quantization      : Default (maps to Limited Range)
Flags             : 
Crop Capability Video Capture:
Bounds      : Left 0, Top 0, Width 640, Height 480
Default     : Left 0, Top 0, Width 640, Height 480
Pixel Aspect: 1/1
Selection Video Capture: crop_default, Left 0, Top 0, Width 640, Height 480, Flags: 
Selection Video Capture: crop_bounds, Left 0, Top 0, Width 640, Height 480, Flags: 
Streaming Parameters Video Capture:
Capabilities     : timeperframe
Frames per second: 30.000 (30/1)
Read buffers     : 0

User Controls

                     brightness 0x00980900 (int)    : min=-64 max=64 step=1 default=10 value=40
                       contrast 0x00980901 (int)    : min=0 max=95 step=1 default=30 value=20
                     saturation 0x00980902 (int)    : min=0 max=128 step=1 default=75 value=75
                            hue 0x00980903 (int)    : min=-40 max=40 step=1 default=0 value=0
        white_balance_automatic 0x0098090c (bool)   : default=1 value=1
                          gamma 0x00980910 (int)    : min=72 max=500 step=1 default=100 value=100
                           gain 0x00980913 (int)    : min=0 max=100 step=1 default=0 value=0
           power_line_frequency 0x00980918 (menu)   : min=0 max=2 default=2 value=2 (60 Hz)
0: Disabled
1: 50 Hz
2: 60 Hz
      white_balance_temperature 0x0098091a (int)    : min=2800 max=6500 step=1 default=6500 value=6500 flags=inactive
                      sharpness 0x0098091b (int)    : min=0 max=6 step=1 default=3 value=3
         backlight_compensation 0x0098091c (int)    : min=0 max=2 step=1 default=1 value=1

Thursday, July 16, 2020

rc.local on kali2020

I love old school /etc/rc.local files to run scripts at boot.
This fixes some bugs from the last one I posted.  Still learning systemd...


$ cat rc.local.sh

cat <<'EOF' > /etc/systemd/system/rc-local.service
 [Unit] 
  Description=/etc/rc.local Compatibility 
  ConditionPathExists=/etc/rc.local 
 [Service] 
  Type=forking 
  ExecStart=/etc/rc.local start 
  TimeoutSec=0 
  StandardOutput=tty 
  RemainAfterExit=yes 
  SysVStartPriority=99 
 [Install] 
  WantedBy=multi-user.target 
EOF

printf '%s\n' '#!/bin/bash' 'exit 0' | tee -a /etc/rc.local 
chmod +x /etc/rc.local
systemctl enable rc-local 
systemctl start rc-local.service 
systemctl status rc-local.service

Wednesday, October 9, 2019

rc.local on kali19.3

Based on https://www.linuxbabe.com/linux-server/how-to-enable-etcrc-local-with-systemd A ton of apps don't have systemd scripts.
cat makerc-local.sh
 #!/bin/bash  
 #create a service that runs /etc/rc.local at boot based on  
 #https://www.linuxbabe.com/linux-server/how-to-enable-etcrc-local-with-systemd  
 cat > /etc/systemd/system/rc-local.service <<EOL  
 [Unit]  
  Description=/etc/rc.local Compatibility  
  ConditionPathExists=/etc/rc.local  
 [Service]  
  Type=forking  
  ExecStart=/etc/rc.local start  
  TimeoutSec=0  
  StandardOutput=tty  
  RemainAfterExit=yes  
  SysVStartPriority=99  
 [Install]  
  WantedBy=multi-user.target  
 EOL  
 printf '%s\n' '#!/bin/bash' 'exit 0' | tee -a /etc/rc.local  
 systemctl enable rc-local  
 systemctl start rc-local.service  
 systemctl status rc-local.service  

Monday, July 4, 2016

hddtemp + gkrellm

Here is how I got gkrellm to show my hard drive temperatures on kali2.

apt-get -y install hddtemp gkrellm*

edit /etc/default/hddtemp set RUN_DAEMON="true"
update-rc.d hddtemp enable
/etc/init.d/hddtemp start still didnt start in daemon mode,

http://ubuntuforums.org/showthread.php?t=1359129 shows you have to run
sudo dpkg-reconfigure hddtemp
I set it in suid mode and to run in daemon mode, then ran /etc/init.d/hddtemp start and it kept running:

# ps aux | grep hdd
root     25386  0.0  0.0   6308  1968 ?        S    18:07   0:00 /usr/sbin/hddtemp -d -l 127.0.0.1 -p 7634 -s | -S 600 /dev/sda /dev/sdb /dev/sdc

testing it: # telnet localhost 7634

next I try gkrellm-hddtemp: http://www.guzu.net/linux/hddtemp.php

$ make

Type 'make gkrellm1' and then 'make install1'
  or 'make gkrellm2' and then 'make install2'

$ dpkg -l gkrellm
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name           Version      Architecture Description
+++-==============-============-============-=================================
ii  gkrellm        2.3.6~rc1-1  amd64        GNU Krell Monitors

so I want make install2

$ make gkrellm2
gcc -Wall -fPIC -O2 -DGKRELLM2 `pkg-config --cflags gtk+-2.0` -I. -c gkrellm-hddtemp.c
gkrellm-hddtemp.c: In function ‘string_extents’:
gkrellm-hddtemp.c:93:22: warning: passing argument 1 of ‘gdk_string_extents’ from incompatible pointer type
   gdk_string_extents(ext->ts.font, string, &ext->lbearing, &ext->rbearing,
                      ^
In file included from /usr/include/gtk-2.0/gdk/gdk.h:42:0,
                 from /usr/include/gtk-2.0/gtk/gtk.h:32,
                 from /usr/include/gkrellm2/gkrellm.h:47,
                 from gkrellm-hddtemp.c:40:
/usr/include/gtk-2.0/gdk/gdkfont.h:122:10: note: expected ‘struct GdkFont *’ but argument is of type ‘struct PangoFontDescription *’
 void     gdk_string_extents (GdkFont     *font,
          ^
gcc -shared -Wl -o gkrellm-hddtemp.so gkrellm-hddtemp.o
gcc: error: unrecognized command line option ‘-Wl’
Makefile:19: recipe for target 'gkrellm2' failed
make: *** [gkrellm2] Error 1

googling "gcc: error: unrecognized command line option ‘-Wl’"  I find:
http://stackoverflow.com/questions/33114509/gcc-error-unrecognized-command-line-option-wl-in-makfile

so I try to compile it with Wall instead of Wl and it works:

$~/dev/gkrellm-hddtemp-0.2-beta$ gcc -shared -Wall -o gkrellm-hddtemp.so gkrellm-hddtemp.o

$ sudo make install2
install -d /root/.gkrellm2/plugins/
install gkrellm-hddtemp.so /root/.gkrellm2/plugins/

then I run it again as my normal user since it seems to be using ~/.gkrellm2 instead of some dir in /etc, and restart gkrellm:

I see hddtemp in the plugins list and enabling it shows 3 boxes with temperatures.  Success!

Now how to make gkrellm show smartd status?