Pages

Friday, January 8, 2010

Another brick in the (corporate) wall

When trying to open GMail, Google Reader or other Google sites that require authentication, I got the following error:


              Error 107 (net::ERR_SSL_PROTOCOL_ERROR): Unknown error.


I am behind a proxy, that authenticates itself with certificate to GMail. So the traffic goes encrypted to the proxy and only then the proxy encrypts it with the certificate from Google. Anyway, to pass this I added  the --use-system-ssl option for the Chrome shortcut, in the Target field, like: 


"C:\Documents and Settings\\Local Settings\Application Data\Google\Chrome\Application\chrome.exe" --use-system-ssl


I found too little information on the issue and also on what this parameter does, so any information is welcomed. 


Some links:
Chromium Issue 30689,  and one from Chrome support forum.

Thursday, January 7, 2010

Stylesheets in Firefox and Chrome

  1. Background

              A basic security idea for browser's security is the same-origin policy (discussion here) which protects web sites from one another. For example, the same-origin policy stops a news site from reading the contents of your Gmail inbox or use Javascript to access information from other frames in the same window. 
    Different browsers have different security approaches:

    Google Chrome :
    • prevents users from clicking Internet-based hyperlinks to local web pages 
    • blocks local web pages from reading the contents of arbitrary web sites
    Firefox:
    • blocks local web pages from reading Internet pages
    • restricts a local web page to reading only files in the same directory, or a subdirectory
  2. Problem: 
              If you have an .xml file that references an .xls,  (both files are locale),  when I open it in Firefox the stylesheet is not applied. The contents appear unformatted.  If I open it with Chrome a blank page appears,  and I get an error on the Developer Console:
    Unsafe attempt to load URL file:///C:/test.xsl from frame with URL file:///test.xml. Domains, protocols and ports must match.

  3. Workaround:

    • Firefox: This site explains how to enable local documents to have access to all other local documents, including directory listings. And security implications, recommended settings, etc.
    • From a discussion on issue 39616, a workaround for Chrome is to start it with following 2 flags:  --enable-file-cookies --disable-web-security. 

  4. References:

Regular expressions patterns with grep

I know there is a lot of documentation on the topic of regular expression (like the Regexp bible, Mastering Regular Expressions, by Jeffrey Friedl ) so just some short examples I have used:
  1. ls -l |egrep '.*\.[ch]p{0,2}$'
    Matches  strings with a character repeated any number of times (0+), followed by the '.' character which is escaped(to not be interpreted as the '.' which represents any character), then 'c' or 'h' followed by  0, 1, or 2 'p's. '$' means 'end of line' (the caret ('^') could be used similarly to mark the begging of line).
    But this would also match files like  "main.cp" which is not what I want so:
  2. ls -l |egrep '.*\.(c|cpp|h|hpp)$'
    Matches just specific extensions (enclosed in "(...)").
  3. ls -l |egrep -v '.*\.[ch]p{0,2}$'
    The '-v' parameter excludes the lines matching this pattern
  4. ls -l |egrep -w "file123"
    Matches word "file123", but not "file1234" or "file12345". Full description from man grep :
    -w, --word-regexp
        Select  only  those  lines  containing  matches  that form whole words.  The test is that the matching substring must  either  be at  the  beginning  of  the line, or preceded by a non-word constituent character.  Similarly, it must be either at the end  of the line or followed by a non-word constituent character.  Word-constituent characters are letters, digits, and the  underscor
    e
  5. grep -A n -B m 'pattern'
    Shows the lines matching the pattern, and also n lines after, and m lines before the match.
Good references:
Enjoy! :)

Friday, December 11, 2009

Conflict

In all arguments, both solvable and perpetual, no one is ever right. There is no absolute reality in conflict, only two subjective realities.

Fundamental error: believing that the fight is all other's fault.

Thursday, December 10, 2009

Changes

People can change only if they feel that they are basically liked and accepted as they are. When people feel criticized, disliked, and unappreciated they are unable to change.
Instead, they feel under siege and dig in to protect themselves.

Wednesday, December 9, 2009

Vulnerability in HTML prevents opening CHM remote files

Problem:
       After downloading a .chm file from network or Internet, it is treated by windows as untrusted, so when you try to open it, an Action canceled  error page appears:




 Miscrosoft issued updates to fix the bug (Microsoft Security Bulletin MS05-026). To view the file correctly, there are at least 2 methods:
  1. Use HHReg utility to register HTML Help (.chm) files, and make them available for viewing, after they have been downloaded.  Details on how to use it on the site.
  2. A simpler way could also work:
    • Right-click the chm file, and then click Properties.
    • Click Unblock
    • Open the .chm again.
    • Enjoy the pirate copy of the book  :)

Monday, November 23, 2009

AutoIt script to execute on key combination event

     For the Programming section of SecurityOverride, you are required to make a script to resolve a task, given a random input, in a short time, 10-15 seconds.  The method I've used for all the challenges:  I've written an AutoIt  script that:
  • stays active when run
  • after a keyboard combination is pressed:
    • copies the selected text into clipboard
    • gets it, and executes a function on it
    • puts the result in the clipboard
Example for challenge1:


         In order to complete Programming Challenge 1, you must code a script that will reverse the string below, while maintaining the first letter at the beginning.
         Example: chicken -> cnekcih


#comments-start
#comments-start
 ;---------------------------------------
 Autorun program on Ctrl+C event (for SecurityOverride programming)
 ;---------------------------------------
#comments-end 

HotKeySet("^{F1}", "Solve")
Global $input

While 1
 Sleep(10000)
WEnd


Func Solve()
 GetInput()
 ParseInput()
 Exit(0)
EndFunc

Func GetInput()
 Send("^{c}")
 $input = ClipGet()
EndFunc

Func ParseInput()  
 Local $a = StringToASCIIArray($input)
 Local $len = StringLen($input)
 Local $i, $j = 1
 Dim $rez[$len]
 
 $rez[0] = $a[0]
 For $i = $len-1 to 1 Step -1
   $rez[$j] = $a[$i]
   $j = $j + 1
 Next
 
 ClipPut(StringFromASCIIArray($rez))
EndFunc

; cnekcih


References: 

  1. AutoIt official site
  2. Scite IDE for AutoIt3
  3. Great site: SecurityOverride