Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

4chan Source Code

Name: Anonymous 2007-08-01 6:28 ID:rpojcmHJ

Is there anywhere to download the source code of 4chan/other image boards? I'd like to see it just out of curiosity and to possibly set one up for myself and friends.

Name: Anonymous 2008-10-30 17:22

>>76
It has previously made understanding of the aforementioned, as the information.

Name: Anonymous 2008-11-20 2:35

>>79
it also doesn't like filenames like "con.c", "con.h", etc...

Name: Anonymous 2009-01-11 14:08

>>24
☆☆☆ COOL ☆☆☆

Name: Anonymous 2009-01-11 14:31

Last time I saw Kusaba's source there was SQL injection exploit (I think in the password field), so might want to check out and make sure it's sanitised before using.

Was going to tell someone if the fucking website actually existed anymore.

Name: Anonymous 2009-01-11 16:02

I once started writing an image board in bash.

Name: Anonymous 2009-01-11 17:03

mage

Name: Anonymous 2009-01-11 17:09

How about chanr: the `Web 2.0' imageboard software?

Name: Anonymous 2009-01-11 17:21

Name: Anonymous 2009-01-11 17:48

>>88
Oh wow… Username?

Name: Anonymous 2009-01-11 17:51

>>88
Tried to login w/ my tripcode and name bu t it didn't work :(
can anyone help

Name: Anonymous 2009-01-11 19:23

>>88
WTF, an invite-only /b/?

Name: Anonymous 2009-01-11 19:24

WHERES MY INVITE CODE

Name: Anonymous 2009-01-11 19:44

I'm going to try to write an imageboard in lambda calculus.
>>88
Why are you violating shii's sacred trust?

Name: Anonymous 2009-01-11 20:26

Name: Anonymous 2009-01-11 20:57

INVITE ME FAGGOTS

Name: Anonymous 2009-01-11 21:48

>>93
I've stumbled upon that URL before and I don't have access to it.

Name: Anonymous 2009-01-11 22:02

import System.Posix.Time
import System.Environment
import System.IO

import Control.Monad
import Control.Monad.STM
import Control.Concurrent
import Control.Concurrent.STM.TMVar

data Post = Post { up_name :: String
                 , file    :: Maybe String
                 , up_time :: Int
                 , txt     :: String
    } deriving (Show, Read)

data Thread = Thread { posts :: [Post]
                     , eyde  :: Int
    } deriving (Show, Read)

data HState = HState { ibtitle :: String
                     , threads :: [Thread]
    } deriving (Show, Read)

-- -------------------------------------------------------------------------

addPost :: Thread -> Post -> Thread
addPost t p = Thread (posts t ++ [p]) (eyde t)

newThread :: HState -> Post -> HState
newThread h po = h { threads = (Thread [po] (up_time po)): threads h }

addPost' :: HState -> Int -> Post -> HState
addPost' hs idx po =
    let t  = filter (\th -> idx == eyde th) (threads hs)
        nt = addPost (head t) po
        t' = filter (\th -> idx /= eyde th) (threads hs)
     in hs { threads = nt:t' }

addSagedPost :: HState -> Int -> Post -> HState
addSagedPost hs idx po = hs { threads = map (\th ->
    if idx == eyde th then addPost th po else th) (threads hs) }

-- -------------------------------------------------------------------------

formatImage :: Maybe String -> Html
formatImage Nothing  = noHtml
formatImage (Just l) = lnk (image ! [src (fth l)]) l

fth :: String -> String
fth s = take (length s - 4) s ++ "s" ++ drop (length s - 4) s

formatPost :: Post -> Html
formatPost po = p (toHtml (replicate 70 '-')) +++
                p (bold (toHtml "author:")) +++
                (toHtml (up_name po)) +++
                p (formatImage (file po)) +++
                p (bold (toHtml "txt:")) +++
                (toHtml (txt po)) +++
                br +++
                br

replyForm eeydee =
  form (hidden "id" eeydee +++
        (case eeydee of
           "1" -> p (bold (toHtml "create new thread:"))
           _   -> p (bold (toHtml "reply to thread:"))) +++
        p (toHtml "name:") +++
        textfield "name" +++
        p (toHtml "Text:") +++
        textfield "txt" +++
        p (toHtml "file") +++
        afile "upfile" +++
        submit "send" "submit") ! [ method "POST"
                                  , enctype "multipart/form-data"]

formatThread :: Thread -> Html
formatThread t = hr +++
                 foldr ((+++).formatPost) noHtml (posts t) +++
                 replyForm (show (eyde t)) +++
                 hr

renderimgb :: HState -> Html
renderimgb h = (thetitle (toHtml (ibtitle h))) +++
               h1 (toHtml (ibtitle h)) +++
               h2 (toHtml "broken so far: once") +++
               hr +++
               replyForm "1" +++
               (foldr ((+++).formatThread) noHtml $ threads h) +++
               (p $ toHtml $ lnk "source" "http://code.google.com/p/himgb/")

lnk txt hrf = anchor (toHtml txt) ! [href hrf]

-- ------------------------------------------------------------------------

makethumb :: FilePath -> IO ()
makethumb !file = do
    t <- getFileType file
    img <- case t of ".jpg" -> loadJpegFile file
                     ".gif" -> loadGifFile  file
                     ".png" -> loadPngFile  file
    (sizex, sizey) <- imageSize img
    let ratiox = fromIntegral sizex / 100.0
        ratioy = fromIntegral sizey / 100.0
        ratio = max ratiox ratioy
    img' <- resizeImage (round (fromIntegral sizex / ratio))
                        (round (fromIntegral sizey / ratio)) img
    case t of ".jpg" -> saveJpegFile (-1) (fth file) img'
              ".png" -> savePngFile       (fth file) img'
              ".gif" -> saveGifFile       (fth file) img'

mkPost :: String -> Maybe String -> String -> String -> Post
mkPost n f u t = Post { up_name = take 20 (filter isAscii n)
                      , file    = f
                      , up_time = read u
                      , txt     = take 500 (filter isAscii t) }

overwriteConfig :: Handle -> HState -> IO ()
overwriteConfig h cfg = do hSeek h AbsoluteSeek 0
                           hPutStrLn h (show (expirethreads cfg 8))
                           hClose h

validthread :: HState -> String -> Bool
validthread hst idx =
    not $ null $ filter (\th -> eyde th == read idx) (threads hst)

expirethreads :: HState -> Int -> HState
expirethreads hst n = hst { threads = take n (threads hst) }

howmanyposts :: HState -> String -> Int
howmanyposts hst idx =
    let thd = head $ filter (\th -> eyde th == read idx) (threads hst)
    in length (posts thd)

getFileType :: String -> IO String
getFileType s = let fff = map toLower (reverse s) in
    return $ case fff of
        ('g':'e':'p':'j':_) -> ".jpg"
        ('g':'p':'j':_)     -> ".jpg"
        ('f':'i':'g':_)     -> ".gif"
        ('g':'n':'p':_)     -> ".png"
        _                   -> "unknown"

-- ------------------------------------------------------------------------

compute_ :: Int -> IO a -> IO (Maybe a)
compute_ limit computation = do
    result <- atomically newEmptyTMVar
    runner <- forkIO $ do c <- computation
                          atomically $ putTMVar result $ Just c
    reader <- forkIO $ do threadDelay limit
                          killThread runner
                          atomically $ putTMVar result $ Nothing
    a <- atomically $ takeTMVar result
    killThread runner
    killThread reader
    return a

compute :: IO () -> IO ()
compute fn = compute_ (5*10^6) fn >> return ()

-- ------------------------------------------------------------------------

main :: IO ()
main = runCGI (handleErrors imgb)

imgb :: CGI CGIResult
imgb = do
    args    <- liftIO getArgs

    efile   <- liftIO $ openFile "stateh" ReadWriteMode
    idx     <- liftM  (maybe               "" id) $ getInput "id"
    text    <- liftM  (maybe        "silence" id) $ getInput "txt"
    bslfile <- liftM  (maybe          B.empty id) $ getInputFPS "upfile"
    fname   <- liftM  (maybe               "" id) $ getInputFilename "upfile"
    name    <- liftM  (maybe "Anonymous Hero" id) $ getInput "name"

    hst   <- (case args of
      ("purge":_) -> return $ HState "hImgB" []
      _           -> liftM read (liftIO (hGetLine efile)))
    ftype <- liftIO (getFileType fname)
    time  <- liftM show (liftIO epochTime)

    case null idx of
      True  -> do
        liftIO $ do overwriteConfig efile hst
                    hClose efile
        output $ showHtml $ renderimgb hst

      False -> do
        when (ftype == "unknown")
          (fail "images only pls")
        case read idx of
          1 ->
            if B.null bslfile
              then fail "must supply image with new threads"
              else do liftIO $ do
                        let img = "src/"++time++ftype
                        B.writeFile img bslfile
                        compute $ makethumb img
                        let nt = newThread hst (mkPost
                                  name (Just img) time text)
                        overwriteConfig efile nt
                      output $ showHtml $ "Saved!"

          _ -> do liftIO $ do
                    unless (validthread hst idx) (fail
                      "that thread does not exist")
                    when (howmanyposts hst idx >= 20) (fail
                      "that thread has already reached its limit")
                    if B.null bslfile
                      then do when (null text) (fail
                                "reply with either an image or text or both")
                              let nt = addPost' hst (read idx) (mkPost
                                        name  Nothing  time  text)
                              overwriteConfig efile nt
                      else do let img = "src/"++time++ftype
                              B.writeFile img bslfile
                              compute $ makethumb img
                              let nt = addPost' hst (read idx) (mkPost
                                        name  (Just img) time  text)
                              overwriteConfig efile nt
                  output $ showHtml $ "Saved!"

Name: Anonymous 2009-01-11 23:15

>>97
Hello Taro.

Name: Anonymous 2009-01-12 0:04

>>96
hello im shii the fairly simple and easily satisfied person join my community of fairly simple and easily satisfied persons if you payme enough i will give you access to a private area of /b/ ;)
http://shii.org

Name: Anonymous 2009-01-12 0:07

100get

Name: Anonymous 2009-01-16 16:54

Name: Anonymous 2009-03-01 6:33

>>101
What manner of conspiracy is this?

Name: Anonymous 2009-03-01 6:39

i am xibu

Name: FrozenVoid 2009-03-01 7:01

>>103
China Western Development (simplified Chinese: 西部大开发; traditional Chinese: 西部大開發; pinyin: Xībù Dàkāifā), also China's Western Development, Western China Development, Great Western Development Strategy, or the Open Up the West Program is a policy adopted by the People's Republic of China to boost its less developed western regions.

The policy covers 6 provinces (Gansu, Guizhou, Qinghai, Shaanxi, Sichuan, and Yunnan), 5 autonomous regions (Guangxi, Inner Mongolia, Ningxia, Tibet, and Xinjiang), and 1 municipality (Chongqing). This region contains 71.4% of mainland China's area, but only 28.8% of its population, as of the end of 2002, and 16.8% of its total economic output, as of 2003.

___________________________________________
A strange neurosis, evidently contagious, an epidemic mass hysteria. In two weeks, it spread all over town.

Name: Anonymous 2009-03-01 10:58

What software do 420 and 711 use?

Name: Anonymous 2009-03-01 11:08

>>105
Stop being a fucking retard and read what's on those sites.

Name: Anonymous 2009-03-02 2:27

There was a thread on either here or /g/ a month back where an internal server error allowed a user to download the imageboard.php file, perhaps not a great use without the includes etc; but none the less useful if you were infact looking for exploits. Perhaps somebody has it; at any rate the original was posted on pastebin.

Name: Anonymous 2009-03-02 12:34

>>107
try /soc/

Name: Anonymous 2009-03-03 2:22

>>101
hahaha oh wow

shii, you poor little lost shota

Name: Anonymous 2009-03-03 14:22

>>107 see >>108
I remember reposting it there

Name: Anonymous 2009-03-03 14:35

Name: Anonymous 2009-03-03 15:33

>>111
Íslendingur!? Á MÍNU /prog/ ?!

Name: Anonymous 2009-03-03 15:39

>>109
Shii is like either 20 or 21 now.

Name: Anonymous 2009-03-31 14:25

>>59
You used wc -c to find the filesize?

Name: Anonymous 2009-03-31 14:58

>>115
SAGE MOTHERFUCKER, USE IT

Name: Anonymous 2009-03-31 14:58

>>114
Shii is eternally immature.

Name: Anonymous 2009-03-31 20:37

>>117
Well, can't argue with that. But, hey, nothing wrong with being a kid at heart!

Name: Anonymous 2009-03-31 22:34

Name: Anonymous 2009-03-31 23:15

>>119
Stop giving him the attention he craves. He's just a slightly older FrozenVoid who knows PHP instead of Javascript..

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List