Categories
technical

iCloud face man-in-the-middle attack in China

Yesterday, I was posted an article to report iCloud got Man-in-the-middle attack in China,
http://www.zhoushuguang.com/2014/10/icloud-ssl-attack.html
and repost to two major Chinese geek community,
http://www.freebuf.com/news/47744.html
http://www.solidot.org/story?sid=41521

Chinese attacker is running a Man-in-the-middle attack on SSL encrypted traffic between iCloud server and China Unicom users. The ISP (probably asked by the government to do so) replaced the certificate of iCloud with a self-issued one. The government conducted similar attacks against GitHubGoogleWindows Live and Yahoo.

Categories
technical

How to unescape cookie value in php which was escaped in javascript

I am a newbie study php recently, I want operate cookie by Javascript need escape and  unescape the value:

<script Language=Javascript>
function SetCookie(name,value)//两个参数,一个是cookie的名子,一个是值
{

var Days = 30; //此 cookie 将被保存 30 天

var exp = new Date(); //new Date(“December 31, 9998”);
exp.setTime(exp.getTime() + Days*24*60*60*10000);
document.cookie = name + “=”+ escape (value) + “;expires=” + exp.toGMTString();
}
function getCookie(name)//取cookies函数
{
var arr = document.cookie.match(new RegExp(“(^| )”+name+”=([^;]*)(;|$)”));
if(arr != null) return unescape(arr[2]); return null;

}

</script>

Sometime we need operate cookie in PHP, How to unescape cookie value in php which was escaped in javascript? I were google the solution hardly, finally I get the solution below :

<?php

function unescape($s) {
$s= preg_replace(‘/%u(….)/’, ‘&#x$1;’, $s);
$s= preg_replace(‘/%(..)/’, ‘&#x$1;’, $s);
return $s;
}
?>

reference link from here

mark it and for your reference if you can google that 🙂

Categories
technical

How to install Ushahidi on dreamhost server

ushahidi logo small
ushahidi logo

I heard a lot of people talk about Ushahidi, in official site said that The Ushahidi Platform is an open source web application for information collection, vizualisation and interactive mapping, it allows people to collect and share their own stories using various mediums such as SMS, Web Forms, Email or Twitter. so I try to install it on my Dreamhost hosting server. it is have iOS application, it is universal application means work well with iPhone/iPod/iPad once download.

go to http://download.ushahidi.com/ then download Ushahidi, unzip,  open readme.html file, check out Required Extensions, Dreamhost offer all of bellowing php extensions:

Categories
technical

disable post id increase automatically

wordpress make me in trouble ,for example, when I write blog post online, the post id increase automatically,I try google a solutions in blogsearch.google.com, I get a method finaly, but I am not sure it is work.

copy below code into funtions.php , step by step , wp-amdin –> appearance –> editor –> Theme Functions, added below code

/* 关闭自动保存和修订版本 */
remove_action(‘pre_post_update’, ‘wp_save_post_revision’ );
add_action( ‘wp_print_scripts’, ‘disable_autosave’ );
function disable_autosave() {
wp_deregister_script(‘autosave’);
}

I am put this notes here, now post  id is 13, will it increase after save draft ? hope not. let me wait for minutes。

after 30 minutes,modify post many times,

ok, seems it is work now.

Categories
technical

How to export your blog article from google reader?

step by step:

  1. Locate your blog rss address ,ex: http://feed.zuola.com/
  2. Make a simple web page, add code with below format : <a href=”http://www.google.com/reader/atom/feed/http://feed.zuola.com/?n=3721” >save as atom </a> , red block is your blog rss address,replace it with your rss address,  green block is your maximum article number,you can change it to 10,000 if you want;
  3. Login to http://reader.google.com with your google account;
  4. Open your web page , click   “save as atom ” with right button,then you get a atom format file ,another simple ways is, sent a mail to yourself, body is a link like this http://www.google.com/reader/atom/feed/http://feed.zuola.com/?n=3721 , click   “save as atom ” with right button when you receive your email.
  5. upload atom format file to your own site, get a link
  6. Going to  http://atom2rss.semiologic.com/ ,Specify your atom format file location URL, convert it ,get rss format file,transform done.
  7. Finally, we get all of your blog article with rss format, we can import to most blog ,include wordpress ,or blogger.com

That idea is from you xu ‘s wufetcher.py  ,source code form here: http://blog.youxu.info/wufetcher.py  ,I can’t run wufetcher.py correctly in my server, so a write a manually method doing same thing, hope it give some help to you.

Xuyou has export Aiweiwei’s sina blog from google reader : http://blog.youxu.info/2009/07/04/aiweiwe/

here link is a backup of Aiweiwei’s sina blog : http://aiweiweiai.wordpress.com/