Pages

Thursday, January 31, 2013

Fixed header for a html page

I was recently working with an application in which users requested for a fixed header that would not move  with the web page as its users scroll left or right.

I went through a bunch of options  to do it and every attempt I have made in the past with similar requests were kind of close and I had to include the usage of either quick javascrit functions that runs with a specified interval or I had to use the tag named "<!doctype>" and end up screwing my happiness with thanks to the different versions of the beautiful internet explorer.

I dont remember where I got the following stuff, but I really though that using "expression" with css is a no brainer. I also remember words from certain geeks advicing not to rely on them.

May be I dont understand the geeks yet, cos this 'expression' stuff with css seems to be good. Following is what I am taking about

<div style="left: 0px; left: expression(eval(document.body.scrollLeft)); position: fixed; top: 0px; top: expression(eval(document.body.scrollTop));">
My header contents </div>


I never knew that I had to use expression with eval of something. kriss... Thats some trick that I got to know better and remember. After all it makes life easier. Plus, this still has a few issues with the great internet explorer.Advanced users will eventually never use IE so better find a different browser to always work with.

On top of it, this code, I mean the usage of Expression keyword with Eval keyword is a trouble that you have to go through for IE alone. Because, "position:fixed" alone would do the work in Firefox and Chrome.


Thursday, January 17, 2013

List all ODBC Connections mapped with Lotus Notes using Lotusscript

A while ago I was given a very nice job of finding why a lotus script agent was not able to communicate with a DB2 server. And the nice stupid part about that is I never had acess to even view the log files of the server where the issue occurs. It was kind of frustrating for a while to understand/find the source of the issue with virtually no resources. It was that I was thinking about the most basic of the scenarios like, network problems, lan cable issues etc etc,

So eventually I just wanted to know if there is a way to list down the kind of connections that are prevalent with a lotus domino server and ended up discovering the following. Again I just discovered if for myself. It was always able on the innernet some how of the other.:)

The following code gives you a message box with something like,
 "The usable connections are file, notes, odbc2, oledb"

Atleast this is what I got. Evidently db2 was missing in the list for me and hurray, administrators found it at last that db2 was not mapped properly with the lotusdomino servers after looking at the proof . What ever that means. :P

Dim session As New LCSession
 Dim conName As String
 Dim text_str As String
' list the connectors available
' the parameters for connector code, identity flags, and
' identity names are optional and omitted in this example
 Call session.ListConnector(LCLIST_FIRST, conName)
 text_str = conName
 While session.ListConnector(LCLIST_NEXT, conName)
  text_str = text_str + ", " + conName
 Wend
 Msgbox "The usable Connectors are " & text_str

Thursday, January 3, 2013

Formula inMemory note - Web Hack

When researching about the _doClick related concepts, I found a hack that might possibly be a serializaied representation of the memory segment where a formula command will be stored in a server.

This sounds funny and frightening to me - "Yin and Yang" concept, if I am not wrong.

Well as usual try the following ridiculous stuff and tell me that I am not crazy.

1. Create/open a form in Lotus Notes
2. Create a button and put some formula code inside it as illustrated in the following screen shot.
3. Now navigate to the HTML tab of the button properties dialog and simply add "<>" in the 'Other' field as illustrated in the previous screen shot .

4. Now preview the form in browser and you will be able to see some thing like this

Discussion points in few forums say that these numbers are memory segment representation sort of stuffs in the server with the domino uses via "_click" field in post data or a &click argument in a url  to trigger and execute these formula commands.

Man this stuff is crazy.

_doClick in Lotus Notes - A javascript refresh trigger other than window.reload

This was a strange stuff that I have never encountered before. This is a nice stuff that one can use to screw your lotus domino based web pages with as well. Hope there are not too many hackers around.

I stumbled upon this when I had to avoid a page refresh that was triggered due to selection of the property named "Refresh fields on keyword change" for a combobox field type in the lotus notes form.

It was like there were no ways to impose a partial refresh of web page segments like the ones available with XPages. Eventually search for a desparate hack went in vain but I was able to discover the existence of this particular hack.

Hope this helps some one though I did not have any use for the same. Following is what I am speaking about.

1. Create a form. Include a dropdown "combo" field in it. Give it some options and select the property "Refresh fields on keyword change".



2. The property selection I am speaking about is illustrated as follows

3. Put a date time field near by the combo box and ensure that it displays time upto seconds at any point of its display

 5. Now preview the form on the web. Nothing big right. You see 2 simple fields just as expected
 6. And if you change a value in the dropdown, you page will be refreshed because of the associated option "Refresh fields on keyword change". So eventually, you will be able to see a new time that is computed and displayed on the webpage
 7. Now go back to the designer and uncheck the option "Refresh fields on keyword change" in your combobox properties window
 8. And add the following code in the onchange event of the dropdown box.

_doClick('$Refresh', this, '_self', '#_RefreshKW',"myDropDown")

9. Now save and preview your webpage again and try changing the values in the dropdown again. You will be able to recognize that the page behaves in a simialr way and it is no different from the property selection on the dropdown field.

10. Interesting right.

Now my worry is I guess, I will be able to perform a few hacks with this. So more to think about when developing webpages in future  :(

Hope this helps :)

Thursday, November 22, 2012

A list of Mime Types

Following is a list of mime types of most used file types. I wish I had found this earlier
ExtensionMime TypesFile Types
Audio formats
.sndaudio/basicSun/NeXT audio format
.auaudio/basicSun/NeXT audio format
.aiffaudio/x-aiffApple audio format
.aifcaudio/x-aiffApple audio format
.aifaudio/x-aiffApple audio format
.wavaudio/x-wavWindows WAV format
.midaudio/midWindows MIDI format
.rmiaudio/midWindows MIDI format
Image formats
.bmpimage/bmpWindows bitmap format
.gifimage/gifGIF
.iefimage/iefImage Exchange format
.jpgimage/jpegJPEG
.jpeimage/jpegJPEG
.jpegimage/jpegJPEG
.tifimage/tiffTIFF
.tiffimage/tiffTIFF
.rasimage/cmu-rasterCMU raster format
.pngimage/pngPNG
.pnmimage/x-portable-anymapPBM Anymap format
.pbmimage/x-portable-bitmapPBM Pixmap format
.pgmimage/x-portable-graymapPBM Graymap format
.ppmimage/x-portable-pixmapPBM Pixmap format
.rgbimage/x-rgbRGB format
.xbmimage/x-xbitmap7bit-X bitmap
.xpmimage/x-xpixmapX pixmap format
.xwdimage/x-xwindowdumpX window dump (xwd)
.cmximage/x-cmxCorel CMX format
.icoimage/x-iconX-Icon format
Video formats
.mpgvideo/mpegMPEG
.mpevideo/mpegMPEG
.mpegvideo/mpegMPEG
.qtvideo/quicktimeQuickTime
.movvideo/quicktimeQuickTime
.avivideo/aviMS Video for Windows
.movievideo/x-sgi-movieSGImovieplayer
.asfvideo/x-ms-asfMS Active streaming format
.asxvideo/x-ms-asfMS Active streaming format
.vdovideo/x-vdoliveVDOLive script
Message formats
.emlmessage/rfc822Outlook Mail Message
.mhtmessage/rfc822Mail Message
.mhtmlmessage/rfc822Mail Message
Text formats
.htmltext/html8bit-HTML
.htmtext/html8bit-HTML variant
.htmlstext/html8bit-HTML w/ Server-side includes
.shtmltext/html8bit-HTML w/ Server-side includes
.csstext/css8bit-Cascading Style Sheet
.xmltext/xml8bit-XML
.htctext/x-component8bit-HTML component
.ctext/plain7bit-C source
.htext/plain7bit-C headers
.cctext/plain7bit-C++ source
.cpptext/plain7bit-C++ source
.cxxtext/plain7bit-C++ source
.hhtext/plain7bit-C++ headers
.hxxtext/plain7bit-C++ headers
.mtext/plain7bit-Objective-C source
.f90text/plain7bit-Fortran 90 source
.txttext/plain7bit-Plain text
.rtxtext/richtext7bit-MIME Richtext format
.tsvtext/tab-separated-values7bit-Tab-separated values
.etxtext/x-setext7bit-Structure Enhanced Text
.fortext/plain7bit-Fortran
.martext/plain7bit-MACRO
.logtext/plain7bit-logfiles9
.comtext/plain7bit-scripts
.sdmltext/plain7bit-SDML
.listtext/plain7bit-listfiles
.lsttext/plain7bit-listfiles
.deftext/plain7bit-definition files
.conftext/plain7bit-definition files
.cnftext/plain7bit-definition files
.vcftext/x-vcard7bit-VCard
.manifesttext/cache-manifest7bit-manifest file
Compressed file formats
.gz application/x-gzipGNU Zip
.zipapplication/x-zipPKZIP
.tarapplication/x-tar4.3BSD tar
.ustarapplication/x-ustarPOSIX tar
Lotus application formats
.123application/vnd.lotus-1-2-3Lotus 1-2-3 97
.wk4application/vnd.lotus-1-2-3Lotus 1-2-3 97
.wk3application/vnd.lotus-1-2-3Lotus 1-2-3 97
.wk1application/vnd.lotus-1-2-3Lotus 1-2-3 97
.wksapplication/vnd.lotus-1-2-3Lotus 1-2-3 97
.scmapplication/vnd.lotus-screencamLotus ScreenCam Movie
.lwpapplication/vnd.lotus-wordproLotus Freelance 97
.samapplication/vnd.lotus-wordproLotus Freelance 97
.przapplication/vnd.lotus-freelanceLotus Freelance 97
.preapplication/vnd.lotus-freelanceLotus Freelance 97
.impapplication/vnd.lotus-improvLotus Improv
.odtapplication/vnd.oasis.opendocument.textLotus Symphony OpenDocument Text
.odpapplication/vnd.oasis.opendocument.presentationLotus Symphony OpenDocument Presentation
.odsapplication/vnd.oasis.opendocument.spreadsheetLotus Symphony Opendocument Spreadsheet
Microsoft application formats
.docapplication/mswordMicrosoft Word
.dotapplication/mswordMicrosoft Word
.docxapplication/vnd.openxmlformats-officedocument.wordprocessingml.document
.dotxapplication/vnd.openxmlformats-officedocument.wordprocessingml.template
.docmapplication/vnd.ms-word.document.macroEnabled.12
.dotmapplication/vnd.ms-word.template.macroEnabled.12
.pubapplication/x-mspublisherMicrosoft Publisher
.mppapplication/vnd.ms-projectMicrosoft Project
.potapplication/vnd.ms-powerpointMicrosoft Powerpoint
.pptapplication/vnd.ms-powerpointMicrosoft Powerpoint
.ppsapplication/vnd.ms-powerpointMicrosoft Powerpoint
.ppaapplication/vnd.ms-powerpoint
.pptxapplication/vnd.openxmlformats-officedocument.presentationml.presentation
.potxapplication/vnd.openxmlformats-officedocument.presentationml.template
.ppsxapplication/vnd.openxmlformats-officedocument.presentationml.slideshow
.ppamapplication/vnd.ms-powerpoint.addin.macroEnabled.12
.pptmapplication/vnd.ms-powerpoint.presentation.macroEnabled.12
.potmapplication/vnd.ms-powerpoint.presentation.macroEnabled.12
.ppsmapplication/vnd.ms-powerpoint.slideshow.macroEnabled.12
.scdapplication/vnd.ms-scheduleMicrosoft Schedule
.wcmapplication/vnd.ms-worksMicrosoft Works
.wdbapplication/vnd.ms-worksMicrosoft Works
.wpsapplication/vnd.ms-worksMicrosoft Works
.wriapplication/x-mswriteMicrosoft Write
.xlaapplication/vnd.ms-excelMicrosoft Excel
.xlcapplication/vnd.ms-excelMicrosoft Excel
.xlmapplication/vnd.ms-excelMicrosoft Excel
.xlsapplication/vnd.ms-excelMicrosoft Excel
.xltapplication/vnd.ms-excelMicrosoft Excel
.xlwapplication/vnd.ms-excelMicrosoft Excel
.xlsxapplication/vnd.openxmlformats-officedocument.spreadsheetml.sheet
.xltxapplication/vnd.openxmlformats-officedocument.spreadsheetml.template
.xlsmapplication/vnd.ms-excel.sheet.macroEnabled.12
.xltmapplication/vnd.ms-excel.template.macroEnabled.12
.xlamapplication/vnd.ms-excel.addin.macroEnabled.12
.xlsbapplication/vnd.ms-excel.sheet.binary.macroEnabled.12
Macromedia formats
.dcrapplication/x-directorShockwave for Director
.dirapplication/x-directorShockwave for Director
.dxrapplication/x-directorShockwave for Director
.swfapplication/x-shockwave-flashShockwave Flash
.splapplication/futuresplashFuture Splash Animator
RealAudio formats
.rmapplication/vnd.rn-realmediaRealPlayer
.rpmaudio/x-pn-realaudio-pluginRealAudio plug-in
.raaudio/x-pn-realaudioRealPlayer
.ramaudio/x-pn-realaudioRealPlayer
.rvvideo/vnd.rn-realvideoRealPlayer
VRML formats
.wrlx-world/x-vrmlVRML
.wrzx-world/x-vrmlVRML
.xafx-world/x-vrmlVRML
.xofx-world/x-vrmlVRML
Other application formats
.cdfapplication/x-cdfChannel file
.323application/h323H.323 Internet Telephony
.jsapplication/x-javascriptJavaScript
.classapplication/octet-streamJava class file
.binapplication/octet-streamUninterpreted binary
.wp5application/wordperfect5.1WordPerfect
.odaapplication/odaOpen Document Architecture
.pdfapplication/pdfAdobe Acrobat
.aiapplication/postscript8bit-Adobe Illustrator
.epsapplication/postscript8bit-Encapulated PostScript
.psapplication/postscript8bit-PostScript
.rtfapplication/x-rtf7bit-RTF
.cshapplication/x-csh7bit-C-shell script
.dviapplication/x-dviTeX DVI
.hdfapplication/x-hdfNCSA HDF data file
.latexapplication/x-latex8bit-LaTeX source
.ncapplication/x-netcdfUnidata netCDF data
.shapplication/x-sh7bit-Shell-script
.tclapplication/x-tcl7bit-TCL-script
.texapplication/x-tex8bit-TeX source
.texiapplication/x-texinfo7bit-Texinfo
.texinfoapplication/x-texinfo7bit-Texinfo
.tapplication/x-troff7bit-Troff
.roffapplication/x-troff7bit-Troff
.trapplication/x-troff7bit-Troff
.manapplication/x-troff-man7bit-Troff with man macros
.meapplication/x-troff-me7bit-Troff with me macros
.msapplication/x-troff-ms7bit-Troff with ms macros
.srcapplication/x-wais-source7bitWAIS source
.bcpioapplication/x-bcpioOld binary CPIO
.cpioapplication/x-cpioPOSIX CPIO
.gtarapplication/x-gtarGnu tar
.sharapplication/x-shar8bit-Shell archive
.sv4cpioapplication/x-sv4cpioSVR4 CPIO
.sv4crcapplication/x-sv4crcSVR4 CPIO with CRC
.icex-conference/x-cooltalkCooltalk
.rrfapplication/x-InstallFromWebInstallFromTheWeb
.wisapplication/x-InstallFromWebInstallFromTheWeb plug-in
.jnlpapplication/x-java-jnlp-fileJava Web Start
.crlapplication/pkix-crlCertificate Revocation List
Hope this helps :)


XSS - Possible measures

I understand that there are some tools like Nessus and Nikto that would help detect such attacks. I have no idea about them though. Just came across these stuffs and hence though of sharing the same.

Following is a shame less copy and paste. Again just wanted to share what I read.


How to Protect Yourself

The primary defenses against XSS are described in the OWASP XSS Prevention Cheat Sheet.
Also, it's crucial that you turn off HTTP TRACE support on all webservers. An attacker can steal cookie data via Javascript even when document.cookie is disabled or not supported on the client. This attack is mounted when a user posts a malicious script to a forum so when another user clicks the link, an asynchronous HTTP Trace call is triggered which collects the user's cookie information from the server, and then sends it over to another malicious server that collects the cookie information so the attacker can mount a session hijack attack. This is easily mitigated by removing support for HTTP TRACE on all webservers.
The OWASP ESAPI project has produced a set of reusable security components in several languages, including validation and escaping routines to prevent parameter tampering and the injection of XSS attacks. In addition, the OWASP WebGoat Project training application has lessons on Cross-Site Scripting and data encoding.

And I guess you can get more ideas on the possible ways by which you can be exploited in http://ha.ckers.org/xss.html.
Hope this helps :)

XSS Cross-site scripting makes me worry


The concept of cross site scripting rang a bell inside me a long time ago. I was kind of wary about it and I even learnt to perform it. Hey I am not a hacker, dont start getting ideas already. Its just that I am curious and feel very happy to experiment stuffs the safe way as most of us prefer to do. Recently I came across a nice post about it in https://www.owasp.org/index.php/Cross-site_Scripting_(XSS).

It was very informative and very useful. I am getting newer ideas even when I am typing this one down. All stuffs posted in the site are basic and clean, but opens up my mind to a lot of potentially harzardous methods, if employed by some one against my sites, would be a massacre.

By my thoughts some of the stuffs that bothers me about how XSS may affect us are

1.
<html>
<body>

<? php
print "Not found: " . urldecode($_SERVER["REQUEST_URI"]);
?>

</body>
</html>

2.
http://testsite.test/<script>alert("TEST");</script>

3.<%...
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("select * from emp where id="+eid);
if (rs != null) {
 rs.next();
 String name = rs.getString("name");
%>

Employee Name: <%= name %>
where name can be an XSS Hack

You can steal user session cookie etc.. and a lot more of such examples can be made

Most of the times when I am into serious mind wrecking program issues, all I would need was one loop hole, however small it may be, and I would fix the issues. I will just get what ever I want out of it.

All I did here was 10 minutes of thinking about what can I do with XSS. And I already got a lot of options.

Worst case, if I could understand a browser, which I definelty can if I spend a couple of months may be, I my self can do idiotic stuffs. So what can a full time hacker be capable of. Hope I dont get a cyber attack. This is scary

Saturday, November 17, 2012

Alert box issues in Sencha Touch 2

I believe there is an issue with the Ext.Msg.alert() dialog in chrome right from the first version of the Sencha Touch. However there were css hacks that have been posted in various forums to handle them.
My point is it only has issues with Chrome and not with safari and I believe mobile devices dont use chrome yet. So I just had this tought running in my head.


Just leave it and get on with your work unless u think, it will keep bothering you. :)

Enable/Disable USB Ports

I had a sudden thought on doing things the hard way. So I just wanted to do something that will be done other than the ordinary way. And thats how I ended up with tampering my USB ports. I really hate simple access restrictions :P
After all its is very useful. I found the following stuff which partially worked.

“HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSTOR”

Right Click “Start” and Click modify
  • To enable USB ports: change the value from “4″ to “3″
  • To disable USB ports: change the Value for “3″ to “4″

I got to admit. I am dumb to have expected this to save me. But atleast I learnt something :)

List of all xtypes in Sencha Touch 2

List of all xtypes
# xtype Class

1 actionsheet Ext.ActionSheet
2 audio Ext.Audio
3 button Ext.Button
4 component Ext.Component
5 container Ext.Container
6 image Ext.Img
7 label Ext.Label
8 loadmask Ext.LoadMask
9 map Ext.Map
10 mask Ext.Mask
11 media Ext.Media
12 panel Ext.Panel
13 segmentedbutton Ext.SegmentedButton
14 sheet Ext.Sheet
15 spacer Ext.Spacer
16 title Ext.Title
17 titlebar Ext.TitleBar
18 toolbar Ext.Toolbar
19 video Ext.Video
20 carousel Ext.carousel.Carousel
21 carouselindicator Ext.carousel.Indicator
22 navigationview Ext.navigation.View
23 datepicker Ext.picker.Date
24 picker Ext.picker.Picker
25 pickerslot Ext.picker.Slot
26 slider Ext.slider.Slider
27 thumb Ext.slider.Thumb
28 tabbar Ext.tab.Bar
29 tabpanel Ext.tab.Panel
30 tab Ext.tab.Tab
31 viewport Ext.viewport.Default

DataView Components
---------------------------------------------
32 dataview Ext.dataview.DataView
33 list Ext.dataview.List
34 listitemheader Ext.dataview.ListItemHeader
35 nestedlist Ext.dataview.NestedList
36 dataitem Ext.dataview.component.DataItem
37
Form Components
---------------------------------------------
38 checkboxfield Ext.field.Checkbox
39 datepickerfield Ext.field.DatePicker
40 emailfield Ext.field.Email
41 field Ext.field.Field
42 hiddenfield Ext.field.Hidden
43 input Ext.field.Input
44 numberfield Ext.field.Number
45 passwordfield Ext.field.Password
46 radiofield Ext.field.Radio
47 searchfield Ext.field.Search
48 selectfield Ext.field.Select
49 sliderfield Ext.field.Slider
50 spinnerfield Ext.field.Spinner
51 textfield Ext.field.Text
52 textareafield Ext.field.TextArea
53 textareainput Ext.field.TextAreaInput
54 togglefield Ext.field.Toggle
55 urlfield Ext.field.Url
56 fieldset Ext.form.FieldSet
57 formpanel Ext.form.Panel