Recent Notes
Displaying keyword search results 1 - 10
Created by voodoo on September 17, 2012 15:02:15
Last update: September 17, 2012 15:02:15
Start gdb with the executable and coredump:
$ gdb <path to executable> core
While in the debugger, use the following commands:
(gdb) where ("shows a summary of the stack")
...
Example debug session from Debugging Under Unix: gdb Tutorial :
Use backtrace (or bt ) to see the callstack:
(gdb) backtrace
#0 Node<int>::next (this=0x0) ...
Inspect the value of item_to_remove at address 0xffbef014 (the value is 1):
(gdb) x 0xffbef014
0xffbef014: 0x00000001
(g...
Note: The program must be compiled with the debug switch -g in order to see the source code.
More resources:
Linux software debugging with GDB
Debugging with gdb
Created by Dr. Xi on August 15, 2012 12:05:39
Last update: August 15, 2012 12:05:39
Use OpenSSL's s_client command to fetch a page manually:
$ openssl s_client -connect localhost:443 -state -...
Sample session for Google:
$ openssl s_client -connect www.google.com:443 -st...
Resource: SSL/TLS Strong Encryption: FAQ
Created by magnum on September 27, 2011 11:57:49
Last update: October 05, 2011 12:20:00
This procedure sets up an IPSec vpn server on Linux with Preshared Key (PSK) using Openswan .
Install Openswan:
# yum install openswan
Edit /etc/ipsec.conf . This is about the minimum needed to run IPSec server. Instead of running L2TP on port 1701, I'm running TCP on port 8080 so that I can test the setup with nc later.
# /etc/ipsec.conf - Openswan IPsec configurati...
Edit /etc/ipsec.secrets .
#
# Preshared key for clients connecting from a...
Start IPSec:
# /etc/init.d/ipsec start
Check status:
# ipsec auto --status
Monitor IPSec log:
# less /var/log/secure
If IPSec is running KLIPS, you should see a new nic ( ipsec0 ). There's no ipsec0 if IPSec is running NETKEY.
# ifconfig
eth0 Link encap:Ethernet HWadd...
Created by magnum on September 28, 2011 09:31:58
Last update: September 28, 2011 09:31:58
This procedure works for xl2tpd . Edit L2TP configuration file /etc/xl2tpd/xl2tpd.conf :
; ; This is a minimal sample xl2tpd configurati... Edit PPP options file for L2TP /etc/ppp/options.xl2tpd.client : ipcp-accept-local ipcp-accept-remote refuse-... Edit PPP authentication file /etc/ppp/chap-secrets : # Secrets for authentication using CHAP # serve... Start xl2tpd : # /etc/init.d/xl2tpd start Connect to the server: # echo "c vpnserver" >/var/run/xl2tpd/l2tp-control Tail /var/log/messages , you should see something like: Sep 28 11:05:46 sta101894 pppd[26059]: pppd 2.4.5 ... ifconfig should show that ppp0 is added: # ifconfig ppp0 ppp0 Link encap:Point-to-P... To tear down the vpn: # echo "d vpnserver" >/var/run/xl2tpd/l2tp-control If authentication fails, try to set "require authentication" to no on both server and client and restart xl2tpd on both sides: # /etc/init.d/xl2tpd restart # echo "c vpnserve......
Created by magnum on September 23, 2011 16:06:02
Last update: September 28, 2011 09:29:53
This procedure works for xl2tpd .
Edit L2TP configuration file /etc/xl2tpd/xl2tpd.conf :
; Sample l2tpd.conf
;
[global]
; listen...
Edit PPP options file for L2TP /etc/ppp/options.xl2tpd :
ipcp-accept-local
ipcp-accept-remote
ms-dns ...
Edit PPP authentication file /etc/ppp/chap-secrets :
# Secrets for authentication using CHAP
# serve...
Start the server:
# /etc/init.d/xl2tpd start
Monitor the log:
# less /var/log/messages
Created by magnum on September 27, 2011 12:55:51
Last update: September 27, 2011 12:55:51
These steps set up a Linux host as IPSec client, using Openswan .
Install Openswan:
# yum install openswan
Edit /etc/ipsec.conf . Instead of L2TP on port 1701, I'm setting up TCP on port 8080 so that I can test the connection with nc .
# /etc/ipsec.conf - Openswan IPsec configuration f...
Edit /etc/ipsec.secrets .
# include /etc/ipsec.d/*.secrets
192.168.0.101 ...
Start IPSec:
# /etc/init.d/ipsec start
Connect to IPSec server:
# ipsec auto --up TCP8080-PSK-CLIENT
104 "TCP80...
Created by freyo on July 29, 2011 16:04:45
Last update: July 29, 2011 16:04:45
To start the Settings application:
# am start -n com.android.settings/.Settings
St...
To start the Browser :
# am start -n com.android.browser/.BrowserActivity...
To start the phone dialer:
# am start tel:210-385-0098
Starting: Intent { ...
Help for am command:
# am
usage: am [subcommand] [options]
...
Created by freyo on June 30, 2011 12:36:26
Last update: July 01, 2011 09:43:54
Code
public void install(View view) {
String url = ...
Screenshots:
Logcat:
D/InstallApp( 338): install: file:///sdcard/GetAp...
Using http://... as the URI for the APK does not work. Android fails to find a handler for the intent (logcat):
No Activity found to handle Intent { act=android.i...
Therefore, download the APK to sdcard then fire the Intent.
Created by freyo on April 01, 2011 14:29:25
Last update: June 29, 2011 13:58:27
Start the emulator ( create an AVD if none exists)
$ tools/emulator -avd Simple8 Create new project $ tools/android create project \ > --package co... where " --target 2 " identifies the target platform as displayed by " tools/android list targets ", which is stored in the properties file default.properties in the project root folder. cd HelloWorld and install debug package onto the running emulator: $ ant install Buildfile: build.xml [set... Launch the Hello World application on the emulator. You'll see something like this: Edit res/values/string.xml , change the contents to: <?xml version="1.0" encoding="utf-8"?> <resourc... Edit res/layout/main.xml , change the contents to: <?xml version="1.0" encoding="utf-8"?> <LinearL... The contents of the text area now refer to a string defined in the resource file strings.xml , instead...
Created by freyo on May 17, 2011 11:13:17
Last update: May 17, 2011 11:13:17
This is an odd-ball content provider in that it doesn't provide database records, but provides a resource as a stream. It can be used to provide media files or XML resources. Start the project with:
tools/android create project --package com.android... Create assets directory and add an XML file ( assets/demo.xml ): <? xml version="1.0" encoding="UTF-8"?> <people... Edit the layout ( res/layout/main.xml ): <?xml version="1.0" encoding="utf-8"?> <LinearL... Edit src/com/android/cptest/Dummy.java : package com.android.cptest; import java.io.... Add content provider ( src/com/android/cptest/XmlResource.java ): package com.android.cptest; import java.io.... Update AndroidManifest.xml : <?xml version="1.0" encoding="utf-8"?> <manifes... Add this section to the end of build.xml : <target name="-package-resources"> <ech... Build and install: ant install Screenshot: Remove the Dummy activity ( AndroidManifest.xml ): <?xml version="1.0" encoding="utf-8"?> <manifes... Create a new project for...