czwartek, 21 listopada 2013

How to reverse a string in BASH

How to reverse a string in #BASH console ?

Example:
#host$ echo -n "sebastian" |rev
naitsabes

How to load image from remote server on the UIImageView in iphone and save to application ?


Save An Image To Application Documents Folder From UIView On IOS.

Example:
//imageUrl = http://sebob.v1.pl/image.jpg
-(NSString *)saveLocalImageFromUrl:(NSString *)imageUrl
{
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentsDirectory = [paths objectAtIndex:0];
    NSString *filename = [imageUrl lastPathComponent]; //get base file name
    NSString *localFilePath = [documentsDirectory stringByAppendingPathComponent:filename];
   
    NSString *foofile = [documentsDirectory stringByAppendingPathComponent:localFilePath];
    BOOL fileExists = [[NSFileManager defaultManager] fileExistsAtPath:foofile];
   
    if(fileExists) {
        NSData *thedata = [NSData dataWithContentsOfURL:[NSURL URLWithString:imageUrl]];
        [thedata writeToFile:localFilePath atomically:YES];
    }
   
    return localFilePath;
}

wtorek, 5 listopada 2013

Doctrine 2 Zend Framework 2 with UTF-8

It's good solution for problem with Doctrine 2 and coding UTF-8.
This configuration set UTF-8 for DB.
This config: YourProjectPath/config/autoload/doctrine.local.php

return array(
'doctrine' => array(
'connection' => array(
'orm_default' => array(
'driverClass' =>'Doctrine\DBAL\Driver\PDOMySql\Driver',
'params' => array(
'host' => 'host',
'port' => '3306',
'user' => 'username',
'password' => 'password',
'dbname' => 'dbname',
'charset' => 'utf8',
'driverOptions' => array(
1002=>'SET NAMES utf8'
))
))));

środa, 20 lutego 2013

Ubuntu mount samba folder

If you have a problem with samba on Ubuntu, try something like this:
You need:
- smb packet or if You don't have, install like that: sudo apt-get install smbclient

Check your samba server, [-L|--list=HOST], [-U|--user=USERNAME]

smbclient -L 192.168.1.xx -U username Enter username's password:
 
Result:

Domain=[WORK_GROUP_NAME] OS=[Unix] Server=[Samba ver.]

Sharename Type Comment 
--------- ---- ------- 
username Disk username devel
 
then: check man mount, man mount.cifs and options and:  

mount -t cifs //192.168.1.xx/username/samba_folder /home/username/local_folder/ -o username=WORK_GROUP_NAME/username,password=passwd

środa, 13 lutego 2013

HowTo: Check RAM Size In Ubuntu Linux

I was looking for the way how check size used memory in Ubuntu, I found like this


ps -e -orss=,args= | sort -b -k1,1n

I know about command top, but it's very satisfactory.

wtorek, 12 lutego 2013

Temperature in html5

It is my first commit to GitHub. I made simple tools for my friend.
It's very simple script in JQuery and HTML5.
It was a year ago, maybe useful for someone.
In the folder "data/" are test measurements in files.

https://github.com/sebob/temperature_html5

I am using FileReader from HTML5 for reading file with data and google.visualization.LineChart.

poniedziałek, 4 lutego 2013

Mysql - Polish chars e.g: ź,ż,ć

How you can search Polish chars e.g: ź,ż,ć etc. in Wordpress using MySql query ?
 
If you uses Wordpress and create db query - not wp_query, check your tables in DB where you searching. In my case helped change from utf8_general_ci COLLATION to utf8_spanish_ci.


prevention: ALTER DATABASE `db_name` DEFAULT CHARACTER SET utf8 COLLATE utf8_polish_ci; and: ALTER TABLE wp_postmeta CONVERT TO CHARACTER SET utf8 COLLATE utf8_polish_ci; 

Maybe you should look to
wordpress/wp-admin/includes/schema.php
before installing wordpress.

I found an interesting solution but it is not optimal!:
CONVERT(table_name USING utf8) COLLATE utf8_polish_ci LIKE '$letter%'

czwartek, 24 stycznia 2013

Top 172 blogs about security.

It's blogs about security, a worth of reading, a list of 172 sites.
Do you know others? worth reading? send me and I'll add to the list.

http://0x6a616d6573.blogspot.com/
http://1337day.com/
http://a4apphack.com/tag/xss
http://aluigi.org/adv.htm
http://blog.cognitivedissidents.com/
http://blog.cr0.org/
http://blog.csdn.net/cnbird2008
http://blog.fortinet.com/
http://blog.g0tmi1k.com/
http://blog.kotowicz.net/
http://blog.portswigger.net/
http://blog.security4all.be/
http://blog.sucuri.net/2012/12/w3-total-cache-implementation-vulnerability.html
http://blog.thoughtcrime.org/
http://blog.trendmicro.com/trendlabs-security-intelligence
http://blog.uncommonsensesecurity.com/
http://blogs.securiteam.com/
http://carnal0wnage.attackresearch.com/
http://cert.gov.pl/
http://cirt.net/
http://community.websense.com/blogs/securitylabs/default.aspx
http://cxsecurity.com/wlb/
http://dereknewton.com/
http://dvlabs.tippingpoint.com/blog/
http://exploit.co.il/blog/
http://feeds.feedburner.com/jadedsecurity/pHAE
http://feeds.feedburner.com/thehackersnews
http://flaker.pl/varlog
http://gynvael.coldwind.pl/
http://gynvael.coldwind.pl/?id=366&lang=pl
http://h.ackack.net/
http://ha.ckers.org/blog
http://hackaday.com/
http://hackthissite.org/
http://hakhub.blogspot.com/
http://ipsec.pl/
http://isc.sans.edu/
http://itbreathes.com/
http://jeffchannell.com/
http://kecoak.org/log/
http://krebsonsecurity.com/
http://labs.m86security.com/
http://labs.securitycompass.com/
http://nakedsecurity.sophos.com/
http://sebob.v1.pl/
http://nationalcybersecurity.com/
http://news.cnet.com/8300-1009_3-.html
http://news.google.com/news?pz=1&cf=all&ned=us&hl=en&q=computer+security&output=rss
http://news.google.com/news?pz=1&cf=all&ned=us&hl=en&q=hacking&output=rss
http://news.hitb.org/
http://news.softpedia.com/newsRSS/Security-5.xml
http://news.ycombinator.com/news
http://newschoolsecurity.com/
http://nfsec.pl/
http://niebezpiecznik.pl/
http://osdir.com/
http://packetstormsecurity.com/
http://packetstormsecurity.com/
http://previous.delicious.com/tag/encryption
http://previous.delicious.com/tag/hacking
http://previous.delicious.com/tag/security
http://r00tsec.blogspot.com/
http://r00tsecurity.org/
http://r00tsecurity.org/db/exploits/
http://rdist.root.org/
http://rdist.root.org/
http://redmine.backtrack-linux.org:8080/projects/backtrack/activity
http://risky.biz/feeds/risky-business
http://rss.feedsportal.com/c/32569/f/491736/index.rss
http://scromix.com/
http://sdteam.unix.net.pl/
http://sebug.net/
http://sebug.net/search?wd=WordPress
http://sec.jetlib.com/
http://secdocs.lonerunners.net/
http://seclists.org/#basics
http://seclists.org/#bugtraq
http://seclists.org/#nmap-hackers
http://seclists.org/#pen-test
http://seclists.org/#webappsec
http://seclists.org/#wireshark
http://secunia.com/
http://secunia.tumblr.com/
http://security.firehost.com/
http://security.stackexchange.com/questions
http://securityreason.com/polish/
http://securityvulns.ru/exploits/
http://shad0wbq.blogspot.com/
http://snakingmax.blogspot.com/
http://software-security.sans.org/blog
http://software-security.sans.org/blog
http://taosecurity.blogspot.com/
http://thecybersaviours.com/
http://thedailywtf.com/
http://thehackerlounge.blogspot.com/
http://thehackernews.com/
http://threatpost.com/en_us
http://threatpost.com/en_us/frontpage
http://threatpost.com/en_us/podcasts/feed/all
http://tophack.pl/
http://v0nsch3lling.blogspot.com/
http://v0nsch3lling.tistory.com/
http://venturebeat.com/
http://wampir.mroczna-zaloga.org/
http://www.0x50sec.org/
http://www.airdemon.net/
http://www.andrewhay.ca/
http://www.andrewhay.ca/
http://www.astalavista.com/
http://www.astalavista.com/index.php?app=blog
http://www.bewizard.com/
http://www.cgisecurity.com/
http://www.cloudscan.me/
http://www.coreboosters.com/
http://www.darknet.org.uk/
http://www.darkreading.com/blog
http://www.delicious.com/tag/hacking
http://www.ehackingnews.com/
http://www.eipiplusone.com/
http://www.ethicalhacker.net/
http://www.evilaliv3.org/
http://www.exploit-db.com/
http://www.f-secure.com/weblog/
http://www.gnucitizen.org/
http://www.h-online.com/security/news/
http://www.haxite.org/
http://www.hungry-hackers.com/
http://www.idontplaydarts.com/
http://www.ihteam.net/
http://www.joomlaexploit.com/
http://www.mckeay.net/
http://www.mckeay.net/
http://www.nds.rub.de/teaching/hackpra/
http://www.networkice.com/news
http://www.pentestit.com/
http://www.phrack.org/index.html
http://www.qualys.com/research/alerts/
http://www.rationalsurvivability.com/blog
http://www.rationalsurvivability.com/blog/
http://www.reddit.com/r/netsec/
http://www.reddit.com/r/netsec/.rss
http://www.schneier.com/
http://www.schneier.com/blog/
http://www.securelist.com/en/
http://www.securelist.com/en/rss/allupdates
http://www.securiteam.com/securitynews/
http://www.securitybistro.com/
http://www.securitybistro.com/blog
http://www.securitybloggersnetwork.com/
http://www.securitynewsportal.com/
http://www.securitytechscience.com/
http://www.securitytube.net/
http://www.shell-storm.org/shellcode/shellcode-all.php
http://www.techrepublic.com/blog/security
http://www.thedarkvisitor.com/
http://www.theregister.co.uk/security/
http://www.theregister.co.uk/security/headlines.atom
http://www.thoughtcrime.org/blog/
http://www.uw-team.org/
http://www.v3.co.uk/
http://www.v3.co.uk/feeds/rss/category/security
http://www.vuxml.org/freebsd/vuln.xml
http://www.wired.com/dangerroom
http://www.wired.com/threatlevel
http://www.wordpressexploit.com/
http://www.zdnet.com/blog/security
https://blog.whitehatsec.com/
https://community.rapid7.com/community/metasploit?view=blog
https://foro.undersecurity.net/
https://securosis.com/blog
https://www.arcabit.pl/virnews
https://www.securelist.com/en/blog

XSS scanner

It is really simple scanner for XSS for pentesters your website.
XSSscan.py
Another who recommend:
Xsser